| ||||||||||
| 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 | |||||||||
求教大神!!!为什么float改成double之后,就wa了呢???#include <stdio.h>
int main()
{
float a[12];
float t;
int i;
for(i=0;i<12;i++)
scanf("%f",&a[i]);
t=0.0;
for(i=0;i<12;i++)
{t+=a[i];}
printf("$%.2f\n",t/12);
return 1;
}
改成
#include <stdio.h>
int main()
{
double a[12];
double t;
int i;
for(i=0;i<12;i++)
scanf("%lf",&a[i]);
t=0.0;
for(i=0;i<12;i++)
{t+=a[i];}
printf("$%.2lf\n",t/12);
return 1;
}
之后就wa了……
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator