Write a program that input marks of eight subjects from
user. Program automatically calculates average and grade of student. Output
should like:
Enter marks of engish 123
Enter marks of urdu 135
Enter marks of computer 56
Enter marks of maths 96
Total marks: ...
Average: ….
Grade: …..
#include <iostream>
#include <conio.h>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,average,total;
cout<<"Enter the marks of English = ";
cin>>a;
cout<<"Enter the marks of Applied Mechanics = ";
cin>>b;
cout<<"Enter the marks of Urdu = ";
cin>>c;
cout<<"Enter the marks of Calculus = ";
cin>>d;
cout<<"Enter the marks of Islamiyat = ";
cin>>e;
cout<<"Enter the marks of Computer Science = ";
cin>>f;
cout<<"Enter the marks of Physics = ";
cin>>g;
cout<<"Enter the marks of Chemistry = ";
cin>>h;
total=a+b+c+d+e+f+g+h;
cout<<"\nTotal = ";
cout<<total;
average=(a+b+c+d+e+f+g+h)/8;
cout<<"\nAverage = ";
cout<<average;
if(total<=800 && total>700)
cout<<"\nGrade A";
else if(total<=700 && total>500)
cout<<"\nGrade B";
else if (total<=500 && total>300)
cout<<"\nGrade C";
else if (total<=300 && total>200)
cout<<"\nGrade D";
else
cout<<"\nFail";
return 0;
}
#include <conio.h>
using namespace std;
int main()
{
int a,b,c,d,e,f,g,h,average,total;
cout<<"Enter the marks of English = ";
cin>>a;
cout<<"Enter the marks of Applied Mechanics = ";
cin>>b;
cout<<"Enter the marks of Urdu = ";
cin>>c;
cout<<"Enter the marks of Calculus = ";
cin>>d;
cout<<"Enter the marks of Islamiyat = ";
cin>>e;
cout<<"Enter the marks of Computer Science = ";
cin>>f;
cout<<"Enter the marks of Physics = ";
cin>>g;
cout<<"Enter the marks of Chemistry = ";
cin>>h;
total=a+b+c+d+e+f+g+h;
cout<<"\nTotal = ";
cout<<total;
average=(a+b+c+d+e+f+g+h)/8;
cout<<"\nAverage = ";
cout<<average;
if(total<=800 && total>700)
cout<<"\nGrade A";
else if(total<=700 && total>500)
cout<<"\nGrade B";
else if (total<=500 && total>300)
cout<<"\nGrade C";
else if (total<=300 && total>200)
cout<<"\nGrade D";
else
cout<<"\nFail";
return 0;
}
0 Questions:
Post a Comment