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

我的用C写的为什么总是在输入数据时总是输入13次呢,不应该的啊。那个大哥大姐帮帮忙看一下吧

Posted by prehacker at 2009-10-20 09:39:34 on Problem 1004
#include<stdio.h>
main()
{
float monthmoney[13],sum=0,average=0;
int i;

for(i=0;i<12;i++)
{
scanf("%f\n",&monthmoney[i]);/*这一行运行的时候怎么总是让输入13个数据呢*/
}
for(i=0;i<12;i++)
{
sum=sum+monthmoney[i];
}
average=(float)sum/12;
printf("%.2f",average);
}

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