Welcome to the forum, katherene
(Next time, click New Thread to start a new topic.)
It depends on how the grades are given to you. They will probably be given in an array, or from a disk file.
The general idea is to initialize Max (and Min) to the first value.
Assuming the grades are stored in an array, the first grade in the list is Grade[0].
Code:
Max = Grade[0]; // Initialize Max and Min before entering the loop.
Min = Grade[0]; // Max and Min are the same until you check the next grade in the list
Then you go into a loop and compare the next grade to the Max & Min, updating if necessary...
Code:
if( Grade[1] > Max) // Update Max if needed
{
Max = Grade[1];
}
if( Grade[1] < Min) // Update Min if needed
{
Min = Grade[1];
}
When you do this in your loop, the array index will be a variable. Something like this:
Grade[i]