title: Average of n numbers in java
body: <p>Using loop I want to calculate the average of n numbers in Java and when user enters 0 the loop ends.
  Here is the code that I have written:</p>
  
  <pre><code>public class start {
      public static void main(String[] args) {
          System.out.println("Enter an int value, the program exits if the input is 0");
          Scanner input = new Scanner (System.in);
          int h = 0;
          while (input.nextInt() == 0){
              int inp = input.nextInt();
              int j = inp;
              int i = 0;
              h = j + i;
              break;
          }
  
          System.out.println("The total is: "+ h);
      }
  }
  </code></pre>
  
  <p>Am I making any logical error?</p>