001、
#include <stdio.h> #define NUMBER 5 // 此处为对象式宏, 运行程序时, main函数体内的NUMBER将被替换为5 int main(void) { int i; int tensu[NUMBER]; int sum = 0; printf("please input %d scores.\n", NUMBER); for(i = 0; i < NUMBER; i++) { printf("NO.%d: ", i + 1); scanf("%d", &tensu[i]); sum += tensu[i]; } printf("sum = %d\n", sum); printf("mean = %f\n", (double) sum / NUMBER); return 0; }
标签:tensu,语言,对象,sum,NUMBER,int,printf,main From: https://www.cnblogs.com/liujiaxin2018/p/16581826.html