Student Portfolio >> Index >> Coding >> Exercise 11
//* enter 10 student scores, state how many have passed and whats the average*//
#include <iostream.h>
int main()
{
short int total, score, passed=0, ave;
int i;
total= 0;
for(i=1; i<=10; i=i++)
{
cout << "Enter value no: " << i << " ";
cin >> score;
if(score >=50)
{
passed= passed + 1;
total= total + score;
ave = total/passed;
}
}
cout << "The total number of students passed= "<< passed << "\n";
cout << "Total average of students passed=" << ave << "\n";
return 0;
}
<< Back Forward >> |
Copyright 2005 Kerstin Kegel