qfedu-c-level/day7/d6.c

19 lines
359 B
C
Raw Normal View History

2023-07-11 19:52:53 +08:00
#include <stdio.h>
static int totalScore;
int totalPersons;
void count(int a, int b, int c)
{
totalScore += a + b + c;
totalPersons++;
}
int main()
{
printf("全局变量值: %d, %d\n", totalPersons, totalScore);
count(90, 100, 89);
count(95, 90, 79);
printf("平均成绩: %.2f\n", totalScore * 1.0 / totalPersons);
return 0;
}