title: How to zigzag numbers in floyd's triangle pattern?
body: <p>I have found a way for zigzag matrix but I am willing to find same as clean code for triangle pattern.</p>
  
  <p>Example:  </p>
  
  <pre><code>input = 3
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1
  32
  456
  </code></pre>
  
  <p>I already coded a numbered matrix code here:</p>
  
  <pre><code>int k=0;
  int t=1;
  int n=4;
  
  for(int i=0;i&lt;n;i++){
  
      for(int j=0;j&lt;n;j++){
          k+=t;
          System.out.print(k);
      }
      k=k+n+t;
      t=-t;
      System.out.println();
  }
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1234
  8765
  9101112
  16151413
  </code></pre>