class CompareNumbersForLoops {
  public static void main(String [] args) {
    // Use only "for loops" in this program.
    
    // Note that: we try out some other little things to see the limits of
    //            Java.  Its good to try something out if you are unsure of how it works
    //            or what you will get (if it is even legal).
    
    // first ask the user how many numbers they wish to compare
    System.out.print("How many numbers do you want to compare? ");
    int max = In.getInt();
    
    // now:  1) get the numbers and determine the highest one.
    //       2) then modify the program to determine the lowest number as well.
    //       3) finally, modify the program to determine the mean value.
    int largest = 0;
    int k = 4; // we were just checking if we could declare k both in the for loop and outside
    int smallest = Integer.MAX_VALUE;
    int totalNums = 0;
    for (int i = 0; i < max; i++) {
      System.out.print("Enter a positive integer");
      int j = In.getInt();
      //     int k = i;  // if you declare k here as well, will it compile?
      if (j > largest) {
        largest = j;
      }
      if (j < smallest) {
        smallest = j;
      }
      totalNums += j;
    }
   // now print out the information you have determined
    System.out.println("The largest number is " + largest);
    System.out.println("The smallest number is " + smallest);
    System.out.println("The meanest number is " + ((double)totalNums/max));
    //   System.out.println("i equals" + i); // does i even exist outside the for loop?
   }
}
