In: Computer Science
C++ Programming in Linux
The program will read the five grades from the keyboard, calculate the median, and then then display it. In addition, the program will calculate the average of the five grades and display it as well. Your program should ask the user to input the five grades and then return the median and average. Continue until the user quits.
#include <iostream>
using namespace std;
int main(){
double arr[5];
double avg;
int ch=1;
while(ch){
avg=0;
cout<<"Enter 5 grades:
";
for(int i=0;i<5;i++){
cin>>arr[i];
avg=avg+arr[i];
}
cout<<"Average :
"<<avg/5<<endl;
cout<<"Median :
"<<arr[2]<<endl;
cout<<"Press 1 to continue 0
to quit: ";
cin>>ch;
}
}

Note : Please comment below if you have concerns. I am here to help you
If you like my answer please rate and help me it is very Imp for me