title: Calculate Average in arrays
body: <p>I want to calculate the average numbers using arrays. I want the program asks for the amount of grades and after I want to put the grade numbers.</p>
  
  <p>After I want to get the average output in a <code>double</code>.</p>
  
  <p>This is my code so far:</p>
  
  <pre><code>public class Average {
  
      public static void main(String[] args) 
      {
          //int n = MyConsole.readInt("Enter number of grades: " );
  
          int a = MyConsole.readInt("Enter grade 1: " );
          int b = MyConsole.readInt("Enter grade 2: " );
          int c = MyConsole.readInt("Enter grade 3: " );
  
          int[] numbers = new int[]{a,b,c};
          numbers[0] = a;
          numbers[1] = b;
          numbers[2] = c;
  
  
          int sum = 0;
  
          for(int i=0; i &lt; numbers.length ; i++)
                  sum = sum + numbers[i];
  
          double average = sum / numbers.length;
  
          System.out.println("Average value of array elements is : " + average);
      }
  }
  </code></pre>