Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

Re:学长学姐们帮忙看一下到底哪儿错了?

Posted by lovelove at 2009-11-08 00:10:54 on Problem 1004
In Reply To:学长学姐们帮忙看一下到底哪儿错了? Posted by:200802007038 at 2009-11-08 00:01:12
>  #include<stdio.h>
> void main()
>  {
>  float a[12];double b=0;
> int i;
>  for(i=0;i<12;i++)
>  scanf("%.2f",&a[i]);
>  for(i=0;i<12;i++)   
>  printf("%f\n",a[i]); 
> for(i=0;i<=11;i++)
>  b+=a[i];
> b=b/12;
>  printf("$%.2f\n",b);
>  }
输入不要那么些 全部最后都统一用double  输出你多余了
#include<stdio.h>
int main()
{
    double a[12];
    double b=0;
    int i;
    for (i=0;i<12;i++)
        scanf("%lf",&a[i]);
    /*for(i=0;i<12;i++)
    printf("%lf\n",a[i]);*/
    for (i=0;i<=11;i++)
        b+=a[i];
    b=b/12;
    printf("$%.2f\n",b);
}

Followed by:

Post your reply here:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator