title: Java using for-loop to produce series of numbers
body: <p>I am trying to write a collection of for-loops that produce the following series of numbers below. I am trying to accommodate my loops to print each series on the same line, with spaces between each term. I am new to java and got really confused on how exactly I can accomplish it. On the right side are the digits I am increasing the counting by. </p>
  
  <pre><code> 1. 4  5  6  7  8  9  10                (+1)
   2. 6  5  4  3  2  1                    (-1)
   3. 2  4  6  8  10  12  14  16          (+2)  
   4. 19  17  15  13  11  9  7  5         (-2)
   5. 7  15  23  31  39                   (+8)
   6. 2  4  8  16  32  64                 (*2)
  </code></pre>
  
  <p>Here is the code the way I tried to accomplish it. I got the first row to work but I'm wondering weather there's an easy way I can create the rest of them without re-duplicating the program. </p>
  
  <pre><code>import acm.program.*;
  
  public class ppLoop extends ConsoleProgram {
      public void run()
      {
          {
  
          for(int row = 1; row &lt; 2; row++)
          {
          print(" " + row + ". ");
  
          for (int col = 4; col &lt; 11; col++)
  
              {
              print(row*col + " ");
              } //col values
  
              println( );
              } //row values
  
          }
  
      }
  }
  </code></pre>
  
  <p>I am new to java and right now going over for-loops and trying to accomplish this in for-loop. If someone could help me out, I would really appreciate it.
  Thank you!
  Edit:
  Here is what happens when I increase the number of rows.</p>
  
  <p><a href="https://i.stack.imgur.com/pQgQz.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/pQgQz.png" alt="enter image description here"></a></p>
  
  <p>Edit:
  Here is the solution of what I had tried accomplishing. Thanks to everyone who helped me.</p>
  
  <pre><code>import acm.program.*;
  public class ppLoop extends ConsoleProgram
  {
      public void run()
      {
          {
          for(int i = 1; i &lt; 2; i++) // One iteration of outer loop
               {
                 print(i + ". "); // print row number 1
  
                  for (int j = 4; j &lt; 11; j++) // loop for row 1   
                  {
                     print(j + " ");
                  } 
                  println( );
                  print((i + 1) + ". ");
  
                  for (int j = 6; j &gt; 0; j--) // loop for row 2
                  {
                     print(j + " ");
                  }
                  println();
                  print((i + 2) + ". ");
  
                  for (int j = 2; j &lt; 17; j = j + 2) // loop for row 3
                  {
                     print(j + " ");
                  }
                   println();
                  print((i + 3) + ". ");
  
                  for (int j = 19; j &gt; 4; j = j - 2) // loop for row 4
                  {
                    print(j + " ");
                  }
                   println();
                  print((i + 4) + ". ");
  
                  for (int j = 7; j &lt; 40; j = j + 8) // loop for row 5
                  {
                    print(j + " ");
                  }
                  println();
                  print((i + 5) + ". ");
  
                  for (int j = 2; j &lt; 65; j = j * 2) // loop for row 6
                  {
                  print(j + " ");
                  }
                  println();
               } 
          } //close outer loop
      } //close public run
  } //close console program
  </code></pre>