[此贴子已经被作者于2022-3-30 21:58编辑过]
#include<stdio.h> int main() { int sum = 0, s, max, i = 0; while (1) { scanf("%d", &s); if (s < 0) break; if (i == 0) max = s; else { if (max < s) max = s; } sum += s; i++; } printf("avg = %f,max = %d", (float)sum / i, max); return 0; }