View Code of Problem 23

#include<bits/stdc++.h>
using namespace std;
#define ma 1000001 
int a[ma]; 
int find(int n);                                
int main(){      
	 int n;
	 while(cin>>n){
		if(!n)break;
	 	cout<<find(n)<<endl;
	 	
	 }
	return 0;
}
int find(int n){
	if(n==1||n==2) return 1;
	else return find(n-1)+find(n-1);
}

Double click to view unformatted code.


Back to problem 23