Check out if elseif
suppose you have 10, 12, 1, 2, 3 as your numbers input
cause 10<12, so that num1<num2 is satisfied, and then num1(10) is your least
so that you won't go any further of the ifelse condition. but this is not right.
You might want to do than pairwise, like say
num1 compare with num2 , you get a min and max
num3 compare with num4 , you get a min and max
and then you compare the two mins together with num5 to determin the min
compare the two max together with num5 to determin the max as well,
Remember if from math perpective, in order to compare 5 numbers , you need at least 10 comparisions, apparently you don't, that is why your code doesn't work.
Hope it helps!!!
JJ
|