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

为什么老是不行,是循环问题?

Posted by adcxy at 2009-04-04 23:27:57
#include<stdio.h>
#include<stdlib.h>
int main(void)
{
	double c,sum;
	int i;
	sum=0;
	i=1;
	do
	{
		scanf("%f",&c);
		if(c==0)break;
		if(c>=0.01&&c<=5.20)
		{
			while(sum<c)
			{
				i++;
				sum+=1.0/i;
			}
			printf("%d card(s)\n",(int)i-1);
			
		}
	}while(1);
	return 0;
}

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