Hello everyone,
I need to write a program that asks the user for 10 numbers and then adds the numbers up. Here's what I've come up with so far.
1 2 3 4 5 6 7 8 9 10 11 12 13
#include <iostream>
usingnamespace std;
int main ()
{
int a, x, total=0;
for (x = 1; x <= 10; x++)
{
cout << "Enter an integer: ";
cin >> a;
total= total + a;
}
cout << "The total is " << a << endl;
}
I can't figure out how to get my program to add up the numbers.