Q. Write a program that inputs marks of ten students. The program displays the numbers of students in each grade. The criteria is as follows:
80 or above A
60 to 79 B
40 to 59 C
Below 40 F
1
Expert's answer
2016-02-08T07:37:35-0500
#include <iostream>
using namespace std;
int main() { /* ** Each item is a grade (A, B, C ,F), wich stores ** the number of students who received her */ uint32_t grades[4] = {0};
cout << "Enter student marks:" << endl;
uint32_t mark = 0;
for(uint32_t i = 0; i < 10; i++) { cin >> mark;
if ( mark >= 80 ) grades[0]++; else if ( mark >= 60 ) grades[1]++; else if ( mark >= 40 ) grades[2]++; else grades[3]++; }
Comments
Leave a comment