View Code of Problem 139

#include<iostream>
using namespace std;
int main(){
	double x;
	while(cin>>x&&x!=0){
		double y=1,sum=0;
		int d=2;
		while(sum<x){
			sum+=y/d;
			d++;
		}
		cout<<d-2<<" card(s)"<<endl;
	}
}

Double click to view unformatted code.


Back to problem 139