Yesterday I went for an interview where I have been asked to create a program to find largest and smallest among 5 numbers without using array.
I know how to create
The > and < are transitive properties, so if a > b and b > c, then a > c. So you can
>
<
a > b
b > c
a > c
int a=10, b=6, c=4, d=21, e=4; int maxNum = a; int maxNum = max(b, maxNum); int maxNum = max(c, maxNum); int maxNum = max(d, maxNum); int maxNum = max(e, maxNum);