title: Printing numbers matrix pattern in C language using nested for loops advanced/moderate debugging
body: <p>THIS IS TO PRINT THE NUMBER MATRIX PATTERN
  hey there I want my code to print numbers in</p>
  <pre><code>    1 2 3 4 5
      5 1 2 3 4            
      4 5 1 2 3
      3 4 5 1 2
      2 3 4 5 1
      1 2 3 4 5
  </code></pre>
  <p>but my code is printing it in</p>
  <pre><code>    1 2 3 4 5
      2 4 3 5 1
      3 4 5 1 2
      4 5 1 2 3
      5 1 2 3 4
      1 2 3 4 5
  </code></pre>
  <p>this manner can you please help me solve this issue?
  THIS IS MY SOURCE CODE WHICH I HAVE USED TO SOLVE THE PROBLEM CAN YOU PLEASE HELP ME DEBUG THIS?</p>
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;stdlib.h&gt;
  
  int main()
  {
      system(&quot;clear&quot;);
      int i,j,n,k=1,l=1;
          printf(&quot;Enter the value of n\n&quot;);
             scanf(&quot;%d&quot;,&amp;n);
          for(i=1;i&lt;=n+1;i++)
          {
              for(j=1;j&lt;=n;j++)
               {
                  k = i+j-1;
                  if(k&gt;n)
                     k-=n;
                  printf(&quot;%d &quot;,k);
          }
          printf(&quot;\n&quot;);
       }
     return 0;
  }
  </code></pre>