Description
毕业君刚找到工作嫌钱少,所以去银行查了过去12个月的存款,问存款平均值是多少
Input
12个月的存款,浮点型
Output
12个月存款的均值,小数点后保留两位小数
Sample Input
100.00
489.12
12454.12
1234.10
823.05
109.20
5.27
1542.25
839.18
83.99
1295.01
1.75
Sample Output
$1581.42
Solution
仅次于a+b的水题……
Code
#include<stdio.h>
int main()
{
float av=0,ba[12];
int i;
for(i=0;i<12;i++)
{
scanf("%f",&ba[i]);
av+=ba[i];
}
av/=12;
printf("$%.2f",av);
return 0;
}