title: How to use Do-While Loop to construct the program
body: <pre><code>public static double avgArry(double[] a) {
          double sum = 0;
          double average = 0;
          int i =0;
  
          while(i&lt;a.length) {
          sum += a[i] ;
          average = sum / a.length;
          ++i;
      }
          return average;
  }   
  
      public static void main(String[] args) {
          // TODO Auto-generated method stub
  double j;
          double[] array = {1.5, 20.3, 4.5, 5.5, 10.3, 450, 20.4, -22.3};
  
          j = avgArry(array);
  
          System.out.format("The average is: %.3f" , j);
  
  
  }
  
  
  }
  </code></pre>
  
  <p>The program above calculates the average of elements in an array. But my issue is how can I put it in Do-While loop? While loop and for-loop have been done by me. Please help me out :,,,(. Please don't judge me I'm new to Java.</p>
  
  <p>The average is: 61.275</p>