title: Find highest,lowest and average in a loop
body: <p>I know it's probably something small that I'm doing wrong. I want it to print the lowest number etc. at the end of the loop, but it always prints zero as lowest. How do I get it to not put the exit mechanism zero as the lowest number.</p>
  
  <p>Any advice please?</p>
  
  <pre><code>class HighLowAve
  {
      public static void main (String[]args)
      {
          int num =0;
          int sum;
          int highest;
          int lowest;
          int index;
          Double average;
  
          highest = num;
          lowest = num;
          sum = 0;
          index = 0;
  
          do
          {
              System.out.println("Enter a number. Press zero to quit ");
              num = EasyIn.getInt();
  
              if (num &gt; highest)
              {
                  highest = num;
              }
              else if (num &lt; lowest) 
              {
                  lowest = num;
              }
  
              sum = sum + num;
              index++;
          }while (num !=0);
  
          average = (double) sum/(index-1);
  
          System.out.println("The highest number was " + highest);
          System.out.println("The lowest number was " + lowest);
          System.out.println("The average number was " + average);            
      }
  }
  </code></pre>