Daffodil International University
Problem Link
//Please follow from main function
#include<stdio.h>
int main(){
int t, i, n, arr[1001], c, sum;
double avg, per;
while(scanf("%d", &t)==1){
while(t--){
sum=0, c=0;
scanf("%d", &n);
for(i=0; i<n; i++){
scanf("%d", &arr[i]);
sum+=arr[i];
}
avg=sum/n;
for(i=0; i<n; i++){
if(arr[i]>avg){
c++;
}
}
per=((double)c/(double)n)*100.00;
printf("%0.3lf%%\n", per);
}
}
return 0;
}
0 Comments