title: Java For Loop Repeating Sequence Triangle Program
body: <p>Can someone help me write the program in Java that prints the following triangle? I'm having trouble coming up with a solution.</p>
  <p>Example User input:</p>
  <p>Enter increment amount: 5
  Enter number of terms in sequence: 7
  The number of rows is always set at 10.</p>
  <p>What I have written so far:</p>
  <pre><code>import java.util.Scanner;
  public class Drawtriangle {
  
      public static void main(String[] args) {
          Scanner scanner=new Scanner(System.in);
          System.out.print(&quot;Enter increment amount:&quot;);
          int incAmt=scanner.nextInt();
          System.out.print(&quot;Enter number of terms in the sequence:&quot;);
          int numOfTerms=scanner.nextInt();
          int number=1;
          for(int row=1; row&lt;=10;row++) {
              
              for(int col=1; col&lt;=row; col++) {
                  
                  System.out.print(number);
              }
              System.out.println();
          }
          scanner.close();
      }
  
  }
  
  </code></pre>
  <p>Output:</p>
  <pre><code>1
  6 11
  16 21 26
  31  1   6   11
  16 21 26 31 1
  6   11  16 21 26 31
  16 11  16  21 26 31 1
  6   11  16 21 26 31 1 6
  11 16 21 26 31 1 6  11 16
  21 26 31  1  6  11 16 21  26 31 
  </code></pre>