Item description
Input n and n student grades (real numbers), and output the fail rate.
Input
The first line of input is an integer n, and the second line is n real numbers, separated by spaces.
Output
Output a real number, which indicates the failing rate, and the result is reserved with 2 decimal places, which is on a separate line.
Sample input Copy
8
98 45 86 79 56 75 90 70
Sample output Copy
0.25
#include<stdio.h>
int main()
{
int n,i,m=0;
double sum;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%lf",&sum);
if(sum<60)
m++;
}
if(n==0)
printf("0.00\n");
else
printf("%.2lf\n",1.0*m/n);
return 0;
}