0

Using for loop, how to write a condition to display the sum of "any ten numbers" entered by the user.

I wrote the following condition but this program does not run values greater than ten.In contrast I want to enter any ten numbers that can be greater than 10. for (int i=1;i <=10;i++)

4th Apr 2017, 2:58 PM
Tehreem
1 Réponse
0
Here is an example of the summation of the 10 numbers : #include <iostream> using namespace std ; int main () { int sum ; int values ; int i ; for ( i = 1 ; i <= 10 ; i++ ) { cout << "Enter your value : " ; cin >> value ; sum += value ; } cout << "The sum is : " << sum ; return 0 ; }
4th Apr 2017, 4:48 PM
handerson scott
handerson scott - avatar