title: Translate for loop to a while and do while loop in Java
body: <p>I created a couple for loops that print lines as such (each new number starts a new line, it doesn't show here):</p>
  
  <p>1<br>
  22<br>
  333<br>
  4444</p>
  
  <p>etc. until it reaches 9 then goes back down to 1.</p>
  
  <p>I am supposed to translate it into both a while and do while loop and have been trying for the past hour and can't seem to do it.</p>
  
  <pre><code>public static void main(String[] args) {  
     for (int x=1;  x &lt;= 9; x++) {
         for (int y = 1; y &lt;=x ; y++){
             System.out.print( x + "");
             }
         System.out.println();
         }
  
      // TODO code application logic here
    for (int x=9;  x &gt;=1; x--) {
         for (int y = 1; y &lt;=x ; y++){
             System.out.print( x + "");
             }
         System.out.println();
  
         }   int y =1;
    int x = 1;
    while (x &lt;9){
  
        while (y &lt;=x){
            y++;
    System.out.print(x +"");{
    }
    System.out.println();
  }
   x++;
  }
  </code></pre>