Answer to Question #292400 in C++ for Muskan

Question #292400

Write a program that takes as input a class score. Output the grade for the class based on the



following guideline:



ï‚· Exactly 100 is A+



ï‚· 90and above is A



ï‚· 80 and above is B



ï‚· 70 and above is C



ï‚· 60 and above is D



ï‚· Anything less than 60 is F



ï‚· Anything more than 100 or less than 0 is invalid input.

1
Expert's answer
2022-01-31T07:56:15-0500
#include <iostream>
using namespace std;


int main(){
	int score;
	cout<<"Enter score[0-100]: ";
	cin>>score;
	if (score==100){
		cout<<"Grade: A+\n";
	}
	else if (score >= 90 && score < 100)
	{
		cout<<"Grade: A\n";
	}
	else if (score >= 80 && score <= 89)
	{
		cout<<"Grade: B\n";
	}
	else if (score >= 70 && score <= 79)
	{
		cout<<"Grade: C\n";
	}
	else if (score >= 60 && score <= 69)
	{
		cout<<"Grade: D\n";
	}
	else if (score >= 0 && score <= 59)
	{
		cout<<"Grade: F\n";
	}else{
		cout<<"Invalid input.\n";
	}


	system("pause");
	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

LATEST TUTORIALS
New on Blog