For loops and addition
<p>So I'm trying to use a for loop to fill the array with the numbers 1-8. Then add:</p>

<p>1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + numb = x</p>

<p>And then save it to an variable called x. I've done filling the array, but I don't know how to calculate the summary of the array + the number you enter. Would appreciate some help a lot. </p>

<pre><code>#include &lt;iostream&gt;

using namespace std;

int main()
{

int array[8];
int numb;
int x; // x = summary of array + numb;

cin &gt;&gt; numb; // insert an number

for (int i = 0; i &lt;= 8; i++)
{
    array[i]=i+1;

}
for (int i = 0; i &lt; 8; i++)
{
    cout &lt;&lt; array[i] &lt;&lt; " + ";
   }

}
</code></pre>
