10/06/27 20:33:36
>>255
#include <stdio.h>
int main(void)
{
int array[] = {34, 57, 45, 21, 89, 63, 39, 48, 78, 68, 76, 84, 92, 53, 62}, eval[3] = {0}, i;
double ave;
for(i = 0, ave = 0.0; i <sizeof array / sizeof *array; i++) {
ave += array[i];
if(array[i] < 0) continue;
else if(array[i] <= 60) eval[0]++;
else if(array[i] <= 80) eval[1]++;
else if(array[i] <= 100) eval[2]++;
}
printf("平均値:%f\n", ave / (sizeof array/ sizeof *array));
printf("0~60の数の個数:%d\n", eval[0]);
printf("61~80の数の個数:%d\n", eval[1]);
printf("81~100の数の個数:%d\n", eval[2]);
return 0;
}