#include <iostream>
#include <string>
using namespace std;
int main()
{
int numofStudents;
int curr, sum=0;
double average;
cout << "Please enter number of students" << endl;
cin >> numofStudents;
cout << "Write grades" << endl;
for (int count = 1; count <= numofStudents;++count) {
cin >> curr;
sum += curr;
}
average = (double)(sum / numofStudents);
cout << "The average grade is "<<average << endl;
return 0;
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter