title: Continuous Loop until Condition is met
body: <p>So I have to create a java project in eclipse for my class. The Assignment is to create a program that will allow the user to enter integers into the program until a certain integer is enter (42). After the integer (42) is entered, the program will then <strong>1</strong>. average all numbers entered. <strong>2</strong>. display the min and max number entered. <strong>3</strong>. Total number of numbers entered. And these have to be calculated without counting the (42). This is what i have so far. I can get input from the user and once they enter 42 the program stops and will display the total but with 42 included. And i'm not sure how i could add in a "count" for the input so i can use the count to display total numbers entered as well as dividing count from sum to give me the average. I appreciate any help. </p>
  
  <pre><code>package assignment6;
  
  import java.util.Scanner;
  
  public class assignment6 {
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
          //Scanner
          Scanner input = new Scanner(System.in);
  
          //Enter integer
          System.out.println("Enter a integer ");
          int data = input.nextInt();
  
          //Accept integers until 42 is entered
          int sum = 42;
          while (data != 42) {
              sum += data;
  
              System.out.println("Enter another integer ");
              data = input.nextInt();
          }
          //Display sum of numbers entered
          System.out.println("The sum of all numbers entered is: " + sum);
  
          //Display Average of numbers entered
          System.out.println("Average of all numbers entered is:" + ( sum/ ));
  
      }
  }
  </code></pre>