123456789101112131415161718192021222324252627282930313233343536373839404142
int main() { int age[10]; int i,sum=0, avg=0; int max=0,min=100; for(i=0;i<10;i++) { cout << "Grade " << i+1 << ": "; cin >> age[i]; } for(i=0;i<10;i++) { sum=sum+age[i]; if(age[i]>max) { max=age[i]; } if(age[i]<min) { min=age[i]; } } avg=sum/10; cout << "Average Grade: " << avg << "%" << endl; return 0; }
---%
cout << "Average Grade: " << abs(avg) << "%" << endl;
1234
cout << "Average Grade: "; if (avg<0)cout << "---"; else cout << avg; cout << "%" << endl;