Answer to Question #23138 in C++ for fadil

Question #23138
Write a C++ program that uses while loop to prompt the user to enter 10 integers and the program will calculate the total for all numbers that are smaller than 20. Display the total.
Question 5
1
Expert's answer
2013-01-29T11:16:20-0500
#include <iostream>

using namespace std;

int main()
{
cout << "enter 10 numbers" << endl;
int k[10];
for(int i=1;i<=10;i++)
{
& cin>>k[i];

}

cout<<endl;

& for(int i=1;i<=10;i++)
{

& if(k[i]<20){cout<<k[i]<<endl;}
}
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 the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS