title: Average user inputted numbers in Java
body: <p>I am trying to get the average of user inputted numbers. Every time I input numbers the output is always-</p>
  
  <p>The sum is 6
  How many numbers: 4
  Average: 2.0</p>
  
  <p>A while loop is required, unfortunately for loops are not allowed. I am pretty new to Java so my formatting is sloppy. Where in my code are my problems?</p>
  
  <pre><code>import java.util.Scanner;
  
  public class LoopsEndingRemembering {
  
      public static void main(String[] args) {
          // program in this project exercises 36.1-36.5
          // actually this is just one program that is split in many parts
  
          Scanner reader = new Scanner(System.in);
          int count = 0;
          int sum = 0;
          int endingVariable = -1;
          int input = 0;
          double average;
  
          while (input &gt;= endingVariable) {
              System.out.println("Type numbers: ");
              input = Integer.parseInt(reader.nextLine());
              sum += count;
              average = (double)sum / count;
              count++;
  
              if (input == endingVariable) {
                  System.out.println("Thank you and see you later!");
                  System.out.println("The sum is " + sum);
                  System.out.println("How many numbers: " + count);
                  System.out.println("Average: " + average);
                  break;
              } 
          }
      }
  }
  </code></pre>