title: add a plus sign in between the numbers in a for loop in C++
body: <p>This is a C++ question. The program looks like this:</p>
  
  <p>Enter a positive integer: 10</p>
  
  <p>1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 + = 55</p>
  
  <p>Problem is that it is adding a plus(+) sign to the last number in the list like in the example above. How do I get it to terminate before the last number?</p>
  
  <p>It should look like this below:</p>
  
  <p>Enter a positive integer: 10</p>
  
  <p>1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9 + 10 = 55</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  
  int add(int n);
  
  int main()
  {
     int n;
  
     cout &lt;&lt; "Enter a positive integer: ";
     cin &gt;&gt; n;
  
     for (int i = 1; i &lt;= n; i++)
     {
       cout &lt;&lt; i &lt;&lt; " + ";
     }
  
     cout &lt;&lt; " =  " &lt;&lt; add(n);
     cout &lt;&lt; "";
  
     cout &lt;&lt; endl;
     system("pause");
     return 0;
  }
  
  // Function to calculate the sum of the numbers using recursion
  int add(int n)
  {
  if (n != 0)
      return n + add(n - 1);
  return 0;
  }
  </code></pre>