65 660
Assignments Done
99,2%
Successfully Done
In October 2018

Answer to Question #1412 in C++ for idaira

Question #1412
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.
Expert's answer
#include "stdafx.h"

int main(int argc, char * argv[]){

int count = 0;

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

& printf("Input number %d: ", i);
& scanf("%d", &in);

& if(in<20) count++;
}

printf("Count: %d\n\n", count);

getchar();
getchar();

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

Assignment Expert
09.02.11, 16:29

You are welcome.

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions