1114: 零起点学算法21——求平均值
1114: 零起点学算法21——求平均值
Time Limit: 1 Sec Memory Limit: 64 MB 64bit IO Format: %lldSubmitted: 4420 Accepted: 1634
[Submit][Status][Web Board]
Description
输入3个浮点数,求出平均值,保留3位小数
Input
输入3个浮点数数(多组数据)
Output
输出平均值,保留3位小数(每组数据一行)
Sample Input
2 3 4
Sample Output
3.000
HINT
double may help you
Source
1 #include<stdio.h> 2 int main(){ 3 double a,b,c; 4 while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF){ 5 printf("%.3f\n",(a+b+c)/3); 6 } 7 return 0; 8 }