View Code of Problem 23

#include<bits/stdc++.h>
using namespace std;
//void swap(int *a, int *b) {
//	int t;
//	t = *a;
//	*a = *b;
//	*b = t;
//}
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) {
		cout << m[n -1]<<endl;
	}
}

Double click to view unformatted code.


Back to problem 23