#include<stdio.h>
int main() {
int number;
double sum = 0;
int count = 0;
double mean;
scanf_s("%d", &number);//visual studio中输入为scanf_s
while (number != -1) {
sum = sum + number;
count++;
scanf_s("%d", &number);
}
mean = sum / count;
printf("%f", mean);
return 0;
}
求平均值(C语言)
最新推荐文章于 2023-10-22 22:51:58 发布