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 piaofushi919 at 2004-12-01 09:09:23 on Problem 1003
In Reply To:Re:请大家帮忙改一下, 为什么不停的运行呢? Posted by:sspp at 2004-11-24 10:27:06
#include <stdio.h>
#include <math.h>
void main()
{
	float a,sum;
    int n,c;
	while (a!=0.00)
	{	
		scanf("%.2f",&a);
		c=0;
		for(n=2,sum=0;sum<a;n++)  // 直接在里面定义SUM=0//
		{
			
				sum+=(float)1/n; // 这里不用IF语句不行吗? 在前面我已经定了SUM〈A, 为什么不停止//
				c++;
		}
		printf("%d card(s)\n",c);
	}
}

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