Q:

Write a program in which user will enter marks of ten students and displays the number 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


Solution:
#include<iostream>
using namespace std;
int main()
{
int marks[10] , a = 0 , b = 0 , c = 0 , f = 0;
cout<<"Enter marks of students:  ";
for(int i=0;i<10;i++)
{
cin>>marks[i];
}
cout<<"\nMarks of Students are as follows: \n";
for(int i=0;i<10;i++)
{
cout<<marks[i]<<"  ";
}
cout<<endl;
for(int i=0;i<10;i++)
{
  if(marks[i]>=80)
  a++;
 
    else if(marks[i]>=60 && marks[i]<80)
    b++;  
        
    else if(marks[i]>=40 && marks[i]<60)
    c++;
      
    else if(marks[i]<40)
    f++;
    } 
cout<<"Number of Students for grade A :  "<<a<<endl;
cout<<"Number of Students for grade B :  "<<b<<endl;
cout<<"Number of Students for grade C :  "<<c<<endl;
    cout<<"Number of Students for grade F :  "<<f<<endl;

return 0;

}


Output:

No comments:

Post a Comment

Please disable your ad blocker to support this website.

Our website relies on revenue from ads to keep providing free content.