title: Write a C++ program using nested loops to output the following numbers to the screen?
body: <p>I wrote a C++ program, but the output I got was unexpected (as shown below).</p>
  
  <p><img src="https://i.stack.imgur.com/hBOVR.jpg" alt="enter image description here"></p>
  
  <pre><code>#include&lt;stdio.h&gt;
  #include&lt;iostream&gt;
  #include&lt;iomanip&gt;
  using namespace std;
  main()
  {
  int a,b;
  for(a=3;a&lt;=21;a+=2)
      {
      printf("\n");
      for(b=1;b&lt;a;b+=2)
          {
          cout&lt;&lt;setw(2)&lt;&lt;a+b-1&lt;&lt;" ";
          }
      }
  cout&lt;&lt;"\n";
  }
  </code></pre>
  
  <p>Can someone help me tweak it, so it runs like this:</p>
  
  <p><img src="https://i.stack.imgur.com/iqB9V.jpg" alt="enter image description here"></p>