Solution to Write a C++ program that accepts marks of five students and then displays their average. … - Sikademy
Author Image

Archangel Macsika

Write a C++ program that accepts marks of five students and then displays their average. The program should not accept mark which is less than 0 and mark greater than 100.

The Answer to the Question
is below this banner.

Can't find a solution anywhere?

NEED A FAST ANSWER TO ANY QUESTION OR ASSIGNMENT?

Get the Answers Now!

You will get a detailed answer to your question or assignment in the shortest time possible.

Here's the Solution to this Question


using namespace std; /* Write a C++ program that accepts marks of five students and then displays their average.  The program should not accept mark which is less than 0 and mark greater than 100. */ #define NO_OF_STUDENTS 5 #define MIN 0 #define MAX 100 int main() { int n=0; float Marks,Avg=0; while(n<NO_OF_STUDENTS) { Marks=MIN-1; while(Marks<MIN || Marks>MAX) { cout<<"Enter Marks ("<<MIN<<" to "<<MAX<<" of Student-"<<n+1<<": "; cin>>Marks; } Avg = Avg + Marks; n++; } Avg = Avg/NO_OF_STUDENTS; cout<<"\n\nFinal Average marks = "<<Avg; return(0); }

Related Answers

Was this answer helpful?

Join our Community to stay in the know

Get updates for similar and other helpful Answers

Question ID: mtid-3-stid-44-sqid-1094-qpid-90