// Arup Guha
// 9/28/09
// Solution to Fall 2009 COP 3223 Section 3 Free Response Question #3
// Determines the minimum and maximum in a list of test grades.

#include <stdio.h>

int main(void) {
  
    // These are safe default values.
    int min=101, max=-1, grade;
    printf("Please enter all of your grades, followed by -1.\n");
    scanf("%d", &grade);
    
    // Loop until we hit the sentinel value. 
    while (grade != -1) {
  
        // Update min if necessary.        
        if (grade < min)
            min = grade;
        // Update max if necessary.
        if (grade > max)
            max = grade;
            
        // Get next grade.
        scanf("%d", &grade);
    }
  
    // Just print the answers.
    printf("The minimum grade was %d.\n", min);
    printf("The maximum grade was %d.\n", max);
    system("PAUSE");
    return 0;
}
