C plue plus program to print result card obtained marks, percentage, and grade using cout, cin and if statements.
#include<iostream>
using namespace std;
int main()
{
int sum,per,eng,urdu,math,isl,phy,che,TotalMarks;
cout<<"\n\tStudent Result Card\n";
cout<<"=================================="<<endl;
cout<<"Enter marks in English: ";
cin>>eng;
cout<<"Enter marks in Urdu: ";
cin>>urdu;
cout<<"Enter marks in Math: ";
cin>>math;
cout<<"Enter marks in Islamiat: ";
cin>>isl;
cout<<"Enter marks in Physics: ";
cin>>phy;
cout<<"Enter marks in Chemistry: ";
cin>>che;
cout<<endl<<"=================================="<<endl;
cout<<"Enter total marks: ";
cin>>TotalMarks;
cout<<"=================================="<<endl<<endl;
sum=eng+urdu+math+isl+phy+che;
cout<<"Total obtained marks: "<<sum<<endl;
per= (100*sum)/TotalMarks;
cout<<"The percentage is: "<<per<<endl;
if (per>90)
{
cout<<"Grade is excellent."<<endl;
}
if(per<89&&per>=80)
{
cout<<"Grade is good."<<endl;
}
if(per<80&&per>=60)
{
cout<<"Grade is Satisfactory."<<endl;
}
if(per<=35)
{
cout<<"Sorry you are fail."<<endl;
}
}
Learn about header files CLICK HERE
Please, share my blog to show your love so, I can add more programs for your love and support.
No comments:
Post a Comment