title: Nested For - Loops to create multiplication table C++
body: <p>I've been trying to overcome this problem for a few hours now and I seem to have one approach to the situation. It seems that the use of selection statements worked in creating the table necessary. Although there are formatting issues.</p>
  
  <p>I'd like to know if there was a way to create the same table 
  <strong>using only nested for-loops as mentioned by our professor</strong>. </p>
  
  <p>Are the selection statements necessary or can we implement a system of nested for loops to acquire the same results?</p>
  
  <p>The image below is the required table:</p>
  
  <p><img src="https://i.stack.imgur.com/sXG2h.png" alt="Here is the required table"></p>
  
  <hr>
  
  <p><strong>But the image below is what I have</strong>:
  <img src="https://i.stack.imgur.com/zRGpA.png" alt="Here is my result"></p>
  
  <p>Below is my code:</p>
  
  <pre><code>for (int i = 0; i &lt;= numChoice; ++i)
      {
          if (i == 0)
          {
              for (int k = 1; k &lt;= numChoice; ++k)
              {
                  cout &lt;&lt; "    " &lt;&lt; k;
              }
              cout &lt;&lt; "\n";
          }
          else
          {
              cout &lt;&lt; i &lt;&lt; " | ";
              for (int j = 1; j &lt;= numChoice; ++j)
              {
                  if (j*i &lt;= 9)
                  {
                      cout &lt;&lt; "   " &lt;&lt; j*i &lt;&lt; "|";
                  }
                  else if (j*i &gt; 9 &amp;&amp; j*i &lt;= 100)
                  {
                      cout &lt;&lt; "  " &lt;&lt; j*i &lt;&lt; "|";
                  }
                  else if (j*i &gt; 99 &amp;&amp; j*i &lt;= 999)
                  {
                      cout &lt;&lt; " " &lt;&lt; j*i &lt;&lt; "|";
                  }
              }
              cout &lt;&lt; "\n";
              for (int k = 0; k &lt;= numChoice; ++k)
              {
                  if (k == 0)
                  {
                      cout &lt;&lt; "-|";
                  }
                  else
                  {
                      cout &lt;&lt; "----|";
                  }
              }
              cout &lt;&lt; "\n";
          }
      }
  </code></pre>