View Code of Problem 23

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

Double click to view unformatted code.


Back to problem 23