-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy path10370.cpp
More file actions
executable file
·43 lines (36 loc) · 818 Bytes
/
10370.cpp
File metadata and controls
executable file
·43 lines (36 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* Problem: Above Average UVa 10370
Programmer: Md. Mahmud Ahsan
Compiled: Visual C++ 6.0
Date: 06-08-04
*/
#include <iostream>
#include <cstdio>
using namespace std;
int main(){
int input; // number of test cases
int *mark; // dynamic memory allocation
int i, j;
double sum, average, result;
int student;
double belowAverage;
cin >> input;
for (i = 0; i < input; i++){
cin >> student;
sum = 0;
belowAverage = 0;
mark = new int[student];
for (j = 0; j < student; j++){
cin >> mark[j];
sum += mark[j];
}
average = sum / student;
for (j = 0; j < student; j++){
if (mark[j] > average)
belowAverage += 1;
}
result = (belowAverage / student) * 100;
printf("%.3f%c\n", result, '%');
delete [] mark;
}
return 0;
}