# Thread: Array (range lowest to highest)

1. ## Array (range lowest to highest)

In this program I have to give the range from lowest to highest of scores for each quiz.

I need some assistance with my if-statment. Im not sure what condition put inside the if-statment. Can someone here help me set it up?

2. I think the simplest way to do this would be like this:

for each quiz:
use two variables called highest and lowest or something, and basically for each value:
if value < lowest then lowest = value
if value > highest then highest = value
print out the quiz number and range

3. Thanks for replying. Okay I'll give it try

4. This is what I implemented. But the output is weird.
for( col = 0; col < QUIZZES; col++ ){
for( row = 0; row < STUDENTS; row++ ){
if( value > high ){
high = value;
}
if( value < low ){
low = value
}
// Should I put I put the high = -1 and low = 100?
}

printf("Quiz %i: %i - %i\n", col, low, high); < - Maybe my printf is wrong ??
}
Here is the output:
Quiz 1: 0 - 0
Quiz 2: 0 - 0
etc...

5. Any suggestions?

6. > low = -1, high = 100; // <- intialized the high and low
Then later
> // Should I put I put the high = -1 and low = 100?

Yes, do the second thing in the place of the first thing.

7. Yea I saw that mistake now it displays as : 101 - -1