info@sislbd.com +8801775 012 358

UVA Online Judge – 10370 – Above Average

#include <stdio.h>

int main()
{
int C,N,numbers[1005],i,totalnumber,count;
float avg,abovestudent;
scanf(“%d”, &C);
while(C >= 1)
{
scanf(“%d”, &N);
totalnumber=0;
for(i=0;i<N;i++)
{
scanf(“%d”, &numbers[i]);
totalnumber += numbers[i];
} // End of for
avg=(float)totalnumber/N;
count=0;
for(i=0;i<N;i++)
if(avg < numbers[i])
count += 1;

abovestudent =(float)count*100/N;
printf(“%.3f%c\n”,abovestudent,37);
C -=1;
}// End of while
} // End of main

spectrum