title: How to find out the smallest, biggest, average, sum of the numbers and numbers of numbers that are randomly enetered?
body: <p>I am quite new in Java and I am asked to finish some certain tasks from my school.</p>
  
  <ol>
  <li>I have to create a program where it asks the user to enter numbers (as many as the user wants)</li>
  <li>But the entering number session will be stopped as soon as the user enters a negative number</li>
  <li><p>And finally the program should print out the following (among the numbers that are entered by the user):</p>
  
  <ul>
  <li>The smallest number </li>
  <li>The largest number </li>
  <li>The sum of the numbers </li>
  <li>The average of the numbers (integer calculations are ok) </li>
  <li>The number of numbers that the user entered</li>
  </ul></li>
  </ol>
  
  <p>However, I was able to come up with the solution of 'Number 1' and 'Number 2'.
  Now I need help to solve the 'Number 3' problem.</p>
  
  <p>Here is the piece of code written by me:</p>
  
  <pre><code>public static void main(String[] args) {
  
      System.out.println("Please enter integer numbers, end with a negative number:  ");
  
      Scanner numbers = new Scanner(System.in);
      int positive = numbers.nextInt();
      while (positive &gt;= 0){
          System.out.println( "\nEnter a number:  ");
          positive = numbers.nextInt();
      }
      System.out.println( "\nYou are done with entering number:  ");  
  }
  </code></pre>
  
  <p>Last but not least,it's my first day and this is the first time I am asking for help here.Hope I was able to make a good impression about me and I am eagerly waiting for the reply. Again sorry for putting the code in a bad way.</p>