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

23 lines
302 B
C
Raw Normal View History

2024-11-27 02:25:12 +00:00
// 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;
}