View Code of Problem 23

#include<iostream>

using namespace std;

int main(){
	int m;
	long long int res[91];
	res[1]=1;
	res[2]=2;
	for(int i=3;i<91;++i){
		res[i]=res[i-1]+res[i-2];
	}
	while(cin>>m,m!=0){
		cout<<res[m]<<endl;
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 23