
import java.util.Scanner;

public class FindMaxForLoop {

	public static void main(String[] args) {
		Scanner input = new Scanner(System.in);
		
		//ask the user how many - n
		System.out.println("How many values? ");
		int n = input.nextInt();
		
		//max so far
		double max = Double.NEGATIVE_INFINITY;
		
		//repeat n times
		for(int i = 1; i <= n; i++) {
			//get the number from the user
			System.out.print("Enter a number: ");
			double value = input.nextDouble();
			
			// is it bigger than the max value so far?
			if(value > max) {
				max = value; //this is the new max
			}
		} //end for
		
		System.out.printf("The largest value is %f.\n", max);
	}

}
