title: How to increase and decrease a series of number in loop
body: <p>I tried to get a output like this:</p>
  
  <pre><code>               1
             2   4   2
          3  5   7   5   3
      4   6  8   10  8   6   4
  5   7   9  11  13  11  9   7   5
  </code></pre>
  
  <p>and I wrote this code:</p>
  
  <pre><code>int input_n = 0;
  int x;
  int rowNumber = 1;
  
  std::cin &gt;&gt; input_n;
  
  int result = 0;
  
  for (int i = 1; i &lt;= input_n; i++)
  {
      std::cout &lt;&lt; std::setw(10 - i);
      rowNumber = i;
      int addCounter = rowNumber - 1;
  
      if (rowNumber == 1)
      {
          std::cout &lt;&lt; std::setw(11) &lt;&lt; rowNumber;
      }
      else 
      {
          for (x = 1; x &lt;= rowNumber + 1; x++)
          {
              std::cout &lt;&lt; rowNumber &lt;&lt; std::setw(3);
              // What Should do here?
          }
  
      }
      std::cout &lt;&lt; std::endl;
  
  }
  </code></pre>
  
  <p>Finally I got this output: </p>
  
  <pre><code>              1
             2  2  2
           3  3   3   3
         4   4   4   4   4
       5   5   5   5   5   5
  </code></pre>
  
  <p>I'm just confused, how I just can get like above output? I tried many loop whiles and for. but I didn't get the right output.</p>