| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
Re:为什么写成sum/12.0就错 写成sum/12就对了???也没有四舍五入。。???!!!In Reply To:为什么写成sum/12.0就错 写成sum/12就对了???也没有四舍五入。。???!!! Posted by:leslie_1 at 2010-07-12 17:42:04 > #include<stdio.h>
Because u forget \n at the end of the output
> int main()
> {
> int i;
> double a,sum=0.0;
> for(i=0;i<12;i++)
> {
> scanf("%lf",&a);
> sum+=a;
> }
> printf("$%.2f",sum/12);
> return 0;
> }
> 我提交上面的就对了
> 把倒数第二行最后写成sum/12.0就wa why???
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator