Answer to Question #7940 in C++ for ronnie

Question #7940
write a program that prompts the user to enter mark for 10 subjects let the program compute the average mark and use it to display a special message in the following points; a)if average mark is less than 40 display fail b)if the average mark is greater than 40 but less than 60 display credit c)if equal to o greater than 60 display distinction d)if less than 0 or greater than 100 display error
1
Expert's answer
2012-03-30T06:49:58-0400
#include<iostream>




using namespace std;




void main()

{

double avg=0, n;

cout << "Enter mark for 10 subjects" << endl;

for(int i=0; i<10; i++){

cout << "Subject #" << i+1 << ": ";

cin >> n;

avg += n;

}

avg /= 10;




if(avg>0 && avg<=40)

cout << "
fail
";

else if(avg>40 && avg<60)

cout << "
credit
";

else if(avg>=60 && avg<=100)

cout << "
distinction
";

else

cout << "
error
";

}

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 first!

Leave a comment

Ask Your question

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS
paypal