Question #13977

write a C++ program that would input 10 grades and output the total passed and total failed.

Expert's answer

#include <iostream>




using namespace std;




void main(){

int passed=0, failed=0, grade;

for(int i=1; i<11; i++){

cout << "Grade #" << i << ": ";

cin >> grade;

if(grade < 3)

failed++;

else

passed++;

}

cout << endl << "Total passed: " << passed;

cout << endl << "Total failed: " << failed;

cout << endl;

}
LATEST TUTORIALS
APPROVED BY CLIENTS