Answer to Question #274647 in C++ for akshay

Question #274647

Consider following fig.. Take phy,chem,math for first sem and EGG,PPs,BEL for second sem, print result eith roll no and name in first year



result


1
Expert's answer
2021-12-02T07:53:49-0500
#include<iostream>
using namespace std;
int main()
{
	string name;
	int phy, chem, math, EGG, PPs, BEL, roll_no, average, sum;
	
	cout<<"\nFIRST SEMESTER EXAMS";
	cout<<"\nEnter the name of the student: ";
	getline(cin, name);
	
	cout<<"\nEnter the student's roll number(e.g 501, numbers only): ";
	cin>>roll_no;
	
	cout<<"\nNow Enter first semester marks as for each subject guided below";
	
	cout<<"\nPhysics: ";
	cin>>phy;
	
	cout<<"\nChemistry: ";
	cin>>chem;
	
	cout<<"\nMathematics: ";
	cin>>math;
	
	cout<<"\nNow Enter second semester marks as for each subject guided below";
	
	cout<<"\nEGG: ";
	cin>>EGG;
	
	cout<<"\nPPs: ";
	cin>>PPs;
	
	cout<<"\nBEL: ";
	cin>>BEL;
	
    cout<<"\nName of the student: "<<name;
	cout<<"\n Student's roll numer: "<<roll_no;
	
	cout<<"\n\nSEMESTER ONE RESULT";


	cout<<"\n Physics     : "<<phy;
	cout<<"\n Chemistry   : "<<chem;
	cout<<"\n Mathematcs  : "<<math;
	 
	cout<<"\n\nSEMESTER TWO RESULT";


	cout<<"\n EGG     : "<<EGG;
	cout<<"\n PPs     : "<<PPs;
	cout<<"\n BEL     : "<<BEL;
	
	sum= phy+chem+math+EGG+PPs+BEL;
	average= sum/6;
	cout<<"\nThe Overrall grade for the YEAR";
    cout<<"\nTOTAL MARKS: "<<sum<<"\n";
	cout<<average<<": ";
	
		if(average>=80 && average<=100){
		cout<<"A";
	}
	else if(average>=70 && average<80){
		cout<<"B";
	}
	
	else if(average>=60 && average<70){
		cout<<"c";
	}
	else if(average>=60 && average<70){
		cout<<"D";
	}
	
	else{
		
		cout<<"FAIL";
	}
 return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment