title: How to print main diagonal of matrix and how to fill matrix with random numbers
body: <p>I have matrix <code>a[i][j]</code> for example <code>i = j = d</code> (for example <code>3</code>) . How can I fill it with random numbers and then I need to show main diagonal and another diagonal over and below matrix. Almost all examples that I found were for c++ but I need to do it in C.</p>
  
  <p>I thought about <code>cycle</code> but I don't know how to use it. According to my idea it should take point <code>a[0][0]</code> and <code>i = 0</code>, <code>i++</code> , <code>i &lt; d</code> and <code>j=0</code>, <code>j++</code>  ,<code>j &lt; d</code>. This will be main diagonal. And another one is <code>i = d</code> , <code>i--</code>, <code>j=0</code> , <code>j++</code> . Therefore it will take both diagonals and then print it though <code>printf</code></p>
  
  <p>It should look like this</p>
  
  <pre><code>1  6  11 16  - main diagonal
  
  13 10 7  4   - additional diagonal
  </code></pre>
  
  <hr>
  
  <pre><code>1  2   3   4
  
  5  6   7   8
  
  9  10  11  12  - random matrix
  
  13 14  15  16
  </code></pre>
  
  <hr>
  
  <pre><code>1  6  11  16 - main diagonal
  
  13 10 7   4  - additional diagonal
  </code></pre>