1
0
mirror of https://github.com/renbaoshuo/202401-programming-assignments.git synced 2024-12-16 15:44:39 +00:00
202401-programming-assignments/【实践课内】12.函数3/6-2 全局变量和静态变量.c

23 lines
302 B
C

// int max=0,min=9999999,total=0;
int fun() {
int x;
static int cnt = 0;
while (scanf("%d", &x) != EOF && x != -1) {
total += x;
if (x > max) {
max = x;
}
if (x < min) {
min = x;
}
cnt++;
}
return cnt;
}