Jul 3, 2013 at 9:23am UTC
Write a program consisting of a while loop, that reads the value of a double each time around. Create two variables that stores the values of the largest and smallest value it read so far.
Jul 3, 2013 at 9:45am UTC
First attempt this on your own. If you face any specific problem then ask. If you have already tried it, then show us your attempt.
Jul 3, 2013 at 11:50am UTC
Yeah i did already.
Okay, here is my specific problem.
i have created two variables, max and min. Each storing the maximum and minimum values respectively.
But the thing is i can only get around this my initializing both values to zero (0).
So after i input my first value, lets say 26,
max = 26 and min = 0
when i input a second value, lets say 32
max=32 and min still = 0
but i dont want that. I dont want the program to read zero. i wan it to read just inputted values.
That is, after inputting first value, lets say 26,
i want:
max=26 and min =26
and after inputting second value, lets say 32
max=32 and min=26
Jul 3, 2013 at 1:34pm UTC
Try setting your min value to the highest value in the range