#include <iostream>
using namespace std;
int main()
{
int a[40], score[20] = {0};
for (int i = 0; i < 40; i++)
{
cout << "Student" << i + 1 << " score is ";
cin >> a[i];
if (a[i] < 0 | a[i] > 20)
{
cout << "mistaken score" << endl;
i--;
}
}
for (int i = 0; i < 40; i++)
{
score[a[i]]++;
}
for (int i = 0; i < 20; i++)
{
cout << score[i] << " students have " << i << endl;
}
}
Comments