title: conversion table from feet and inches to cm
body: <p>I need to write a program which prints the conversion table from feet and inches to centimetres. The numbers printed in row <code>i</code> (counting from zero), column <code>j</code> (counting from zero) of the table should be the cm equivalent of <code>i</code> feet and <code>j</code> inches. <code>i</code> should go from 0 to 7, and <code>j</code> from 0 to 11. Each column should be five characters wide, and the cm figures should be rounded to the nearest integer.</p>
  
  <p>The example of required output is given below:</p>
  
  <pre class="lang-none prettyprint-override"><code>     0 3 5 8 10 13 
      30 33 36 38 41 
      61 64 66 69 71 
      91 94 97 99 102 
  </code></pre>
  
  <p>The code I have prints only one row of inches and column of feet but I don't know how to make into table without producing lots of irrelevant repetitions.</p>
  
  <p>The code is:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  #include &lt;math.h&gt;
  
  int main()
  {
      int i,j;
      int cm,p;
      for (i=0; i&lt;= 11; i++) {
          cm =round(i * 2.54);
          printf ("%5d",cm);
      }
  
      for (j=0; j&lt;=7; j++) {
          p =round(j* 12.0 * 2.54);
          printf ("%5d\n",p);
      }
      return 0;
  }
  </code></pre>
  
  <p>This produces:</p>
  
  <pre class="lang-none prettyprint-override"><code>    0    3    5    8   10   13   15   18   20   23   25   28    0
     30
     61
     91
    122
    152
    183
    213
  </code></pre>
  
  <p>What am I doing wrong?</p>