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 |
谁知道我这个哪里错了。。#include<stdio.h> #include <stdlib.h> int main() { float sum=0; float x; int i; while(scanf("%f",&x)&&x!=0.0) { sum=0; for(i=2;;i++) { sum+=1.0/i; if(sum>x) { printf("%d caed(s)\n",i-1); break; } } } //system("pause"); return 0; } 运行结果没错啊。。 Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator