View Code of Problem 23

#include<bits/stdc++.h>
using namespace std;
int main(){
	long long int a[92];
	a[1]=1;
	a[2]=2;
	for(int i=3;i<=90;++i){
		a[i]=a[i-1]+a[i-2];
	}
	int n;
	while(cin>>n&&n!=0){
		cout<<a[n]<<endl;;
	}
}

Double click to view unformatted code.


Back to problem 23