68 338
Assignments Done
98,8%
Successfully Done
In November 2018

Answer to Question #6381 in C++ for diviyah

Question #6381
write a c++ proggramme that uses while loop to prompt the user to enter 10 integers and the proggramme will calculate the total for all number that are smaller than 20.Display the total.
Expert's answer
#include <iostream>

using namespace std;

int main()
{
int counter=0;
int total=0;
int val=0;

while (counter<10)
{
cout<< "Enter value #"<< counter+1<< " >\t";
cin >> val;
if (val<20) total += val;
counter++;
}

cout<< endl<< "The total of all numbers smaller than 20 is:\t"<< total<< endl;

system("pause");
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions