title: How to display the elements of a 5*5 matrix in the following way?
body: <p>I want to display the output of 5*5 matrix in the following way:</p>
  
  <p>Input:</p>
  
  <pre><code>1 2 3 4 5
  6 7 8 9 0
  1 3 5 7 9
  2 4 6 8 0
  1 4 3 7 0 
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>1 2 3 4 5 0 9 0 0 7 3 4 1 2 1 6 7 8 9 7 8 6 4 3 5
  </code></pre>
  
  <p>I have written the below program, but I can't get output like the above. What is the mistake?</p>
  
  <pre><code>#include&lt;stdio.h&gt;
  int main()
  { 
      int i, j, m, n, a[5][5];
      scanf("%d%d",  &amp; m,  &amp; n);
      if (m &gt;= 1 &amp;&amp; m &lt;= 5 &amp;&amp; n &gt;= 1 &amp;&amp; n &lt;= 5)
      {
         for (i = 0; i &lt; m; i++)
         {
            for (j = 0; j &lt; n; j++)
            {
               scanf("%d", a[i][j]);
            }
         }
         if (m == 5 &amp;&amp; n == 5)
         {
            for (i = 0; i == 0; i++)
            {
               for (j = 0; j &lt; n; j++)
               {
                  printf("%d", a[i][j]);
               }
            }
            for (i = 0; i &lt; n; i++)
            {
               for (j = n - 1; j == n - 1; j++)
               {
                  printf("%d", a[i][j]);
               }
            }
            for (i = n - 1; i == n - 1; i++)
            {
               for (j = n - 2; j &gt;= 0; j--)
               {
                  printf("%d", a[i][j]);
               }
            }
            for (i = n - 2; i &gt;= n - 4; i--)
            {
               for (j = 0; j == 0; j++)
               {
                  printf("%d", a[i][j]);
               }
            }
            for (i = n - 4; i == n - 4; i++)
            {
               for (j = n - 4; j &lt;= n - 2; j++)
               {
                  printf("%d", a[i][j]);
               }
            }
            for (i = n - 3; i == n - 3; i++)
            {
               for (j = n - 2; j &gt;= n - 4; j--)
               {
                  printf("%d", a[i][j]);
               }
            }
         }
      }
      return 0;
  }
  </code></pre>