This program takes the marks of three subjects from the user and assigns grade to the user based upon the overall marks obtained. The grading is in this way, Grade A if greated than 200, Grade B if greater than 100 and Grade C if less than that.
[code='cpp']#include
char tot(int,int,int);
void main()
{
int m1,m2,m3;
char g;
cin>>m1>>m2>>m3;
g=tot(m1,m2,m3);
cout<
char tot(int a,int b,int c)
{
int sum;
char grade;
sum=a+b+c;
if(sum>=200 &&sum<=300)
grade='A';
else if(sum>=100 && sum<=200)
grade='B';
else
grade='C';
return grade;
}
[/code]
