level 2
幽冥Top灬寒
楼主
#include<stdio.h>
#define SIZE 10
#define FAR 72
int main(void)
{
int index, score[SIZE];
int sum = 0;
float average;
printf("Enter %d golf scores;\n", SIZE);
for (index = 0; index < SIZE; index++)
scanf("%d", &score[index]);
printf("The scores read in are as follow:\n");
for (index = 0; index < 10; index++)
printf("%5d", score[index]);
printf("\n");
for (index = 0; index < 10; index++)
sum += score[index];
average = (float)sum / 10;
printf("Sum of scores=%d,average=%.2f\n", sum, average);
printf("That's a handicap of %.0f.\n", average - FAR);
getchar();
return 0;
}
2016年01月19日 07点01分
1
#define SIZE 10
#define FAR 72
int main(void)
{
int index, score[SIZE];
int sum = 0;
float average;
printf("Enter %d golf scores;\n", SIZE);
for (index = 0; index < SIZE; index++)
scanf("%d", &score[index]);
printf("The scores read in are as follow:\n");
for (index = 0; index < 10; index++)
printf("%5d", score[index]);
printf("\n");
for (index = 0; index < 10; index++)
sum += score[index];
average = (float)sum / 10;
printf("Sum of scores=%d,average=%.2f\n", sum, average);
printf("That's a handicap of %.0f.\n", average - FAR);
getchar();
return 0;
}