Input the grades of a student by taking marks in 3 different subjects using arrays. 2 points
Use functions to Design a grade calculator based on following criteria: 2 points
If the student scores 60 above in all three subjects, then he should get an A grade. 2 points
If the student scores 60 above in only one subject, he gets a B grade. 2 points
If he scores 60 below in all subjects he scores C grade.
#include<iostream>
using namespace std;
int main()
{
int a[3],i;
cout<<"Enter marks in 3 subjects : ";
for(i=0;i<3;i++)
{
cin>>a[i];
}
if(a[0]>60 && a[1]>60 && a[2]>60)
{
cout<<"You have secured an A grade.";
}
else
{
if(a[0]>60 || a[1]>60 || a[2]>60)
{
cout<<"You have secured a B grade.";
}
else
{
cout<<"You have secure a C grade.";
}
}
}
Comments
Leave a comment