title: How to print ring type output in c?
body: <p>I have c program problem to print the ring type output.
  <br><strong>When user enter the number 5, then program output is look like;</strong><br></p>
  
  <pre><code>1     2      3     4    5
  16    17    18    19    6
  15    24    25    20    7
  14    23    22    21    8
  13    12    11    10    9
  </code></pre>
  
  <p>I use following logic but i really failed i not have any idea.</p>
  
  <pre><code> int main()
      {
          int a[50],i,j=0,n,k;
          printf("Enter the number=");
          scanf("%d",&amp;n);
  
          for(i=1;i&lt;=n;i++)
          {
  
              if(i&gt;n)
              {
                  j=j+5;
              }
              else if(i&gt;((2*n)-1))
              {
                  j--;
              }
              else if(i&gt;((3*n)-2))
              {
                  j=j-5;
              }
              else if(i&gt;(4*n-4))
              {
                  j++;
              }
          }
      }
  </code></pre>
  
  <p><br>Sorry for asking whole program logic but
  ,I really dont have any idea,Please help me.....</p>