title: How to write a program to get minimum, maximum and average of values
body: <pre><code>public static void main(String[] args) {
  
  int sum = 0; 
  int inputNum;
  int counter;
  float average;
  double Max = 0; 
  double Min = 101;      
  
  Scanner NumScanner = new Scanner(System.in);
  Scanner charScanner = new Scanner(System.in); 
  System.out.println("Enter the total number of exams you want a average");
  counter = NumScanner.nextInt();
  System.out.println("Please enter " + counter + " numbers:");
  
  for(int i = 1; i&lt;=counter ;i++){          
      inputNum = NumScanner.nextInt();
      sum = sum + inputNum;
      System.out.println();
  
      if(inputNum &gt; Max){
          Max = inputNum;
      }
      if(inputNum &lt; Min){
          Min = inputNum;
      }
      if(inputNum &gt; -1 &amp;&amp; inputNum &lt; 101){
          sum = sum + inputNum;
      }
      else{
          System.out.println("You entered a number that wasn't in the range of 0 to 100");
          average = sum / counter;
      }
      }
  }
  }
  </code></pre>
  
  <p>Write a program using a loop that takes 10 values from a user representing exam grades (between 0 and 100) from the keyboard and outputs the minimum value, maximum value and average value of all the values entered.  Your program should not accept values less than 0 or greater than 100. Problems with calculation of average and the program does not print out max and min values</p>
  
  <p>How can I do this?</p>