// Arup Guha
// 7/15/08
// Written in class (BHCSI) to illustrate how to find the minimum
// and maximum value in a list.

import java.util.*;

public class Max {
	
	public static void main(String[] args) {
		
		int grade, min, max;
		Scanner input = new Scanner(System.in);
		
		System.out.println("Enter grades, end with 0.");

		// Read in the first grade.		
		grade = input.nextInt();
		min = grade;
		max = grade;
		
		// Keep on reading until you hit 0.
		while (grade != 0) {
			
			// Update for a new minimum grade.
			if (grade < min) {
				min = grade;
			}

			// Update for a new maximum grade.
			else if (grade > max) {
				max = grade;
			}
			
			// Get the next grade.
			grade = input.nextInt();
		}		

		// Print out the results.
		System.out.println("The lowest grade was "+min);
		System.out.println("The highest grade was "+max);
	}
}
