This is it:
First let's assume these are the user inputs in the array:
then it assigns 2 to the variables max,mid & low because, it assigns the value contained by the first element in the array to max & mid & low:
the the for
for (int i=0 ; i<5; i++)
if ( max<array[i])
else if ( low>array[i])
first, this for
loop, declares and initializes an int i to 0:
then if i<5 the loop will work!!! because that is the condition, and it is met because i=0 also i++ means i should increase by 1, any time the loop fully works!
in the loop, there is an if statement that checks if the current value in max(which is 2 in my example) is lesser than the value in the first element of the array.
if(max<array[i]) //here i's value is 0 on the first run of the loop and is equivalent to array
and it is not so it does not meet the condition and therefore moves on to the else if statement, which works just like the first if statement.
then when it finishes, it increases i by 1 and checks the condition again, which is eventually met.
So it goes to the if, this time i=1 and not 0
so since array or array=3, max would be given the value array contains, which is 3.
It does this until the for loop eventually ends.
Then it displays max and min, which would eventually be 9 and 1 respectively!!! computer stuff !!!LOL!!!