Question

C++ pls use iostream Write a program that prompts the user to enter 5 exam marks...

C++ pls use iostream
Write a program that prompts the user to enter 5 exam marks (design your program such that It would be easy to change if we wanted it to work for more than 5 earns). The program python displays the average mark, the highest mark, and number of marks entered less than the average mark

0 0
Add a comment Improve this question Transcribed image text
Answer #1

#include<iostream>

#include<limits.h>

#define n 5 //n denotes number of exam marks

using namespace std;

int main()

{

double arr[n], hmarks=(double)INT_MIN, sum=0, avg;

int i,count=0;

cout<<"Enter the marks in "<<n<<"Exam Marks"<<endl;

for(i=0;i<n;i++){

cin>>arr[i];

sum+=arr[i];

if(hmarks<arr[i])

hmarks = arr[i];

}

avg=sum/((double)n);

for(i=0;i<n;i++)

if(arr[i]<avg)

count++;

cout<<"Average Mark : "<<avg<<"\nHighest Marks : "<<hmarks<<"\nNumber of marks entered less than the average mark : "<<count<<endl;

return 0;

}

Add a comment
Know the answer?
Add Answer to:
C++ pls use iostream Write a program that prompts the user to enter 5 exam marks...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT