Hi dears;
i have written a code for c++ . this code recieve n and then recieve n student grades ,,, and finally it finds the average of grades !
Code:
#include <iostream>
#include <conio.h>
using namespace std;
int main(){
int n,count=0,sum=0;
float grade,avg;
cout << "How many students grade do you want to input ? \n" <<endl;
cin >> n;
cout << endl;
cout << "Please enter the student grade : \n"<<endl;
while (count<n){
cin >> grade;
cout << endl;
sum += grade;
count++;
}
avg = (float)(sum)/(float)(n);
cout << avg;
getch();
return 0;
}
but now i want to calculate the average of the "first (n-1) top grades ! "
now my idea : finiding the min grade between inputed grades and sustract it from sum ... but i dont exactly know how can i find it between inputed grades !!! can u help me ?? tnx;