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.
1
Expert's answer
2012-02-07T15:44:33-0500
#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;
Numbers and figures are an essential part of our world, necessary for almost everything we do every day. As important…
APPROVED BY CLIENTS
Finding a professional expert in "partial differential equations" in the advanced level is difficult.
You can find this expert in "Assignmentexpert.com" with confidence.
Exceptional experts! I appreciate your help. God bless you!
Comments
Leave a comment