View Code of Problem 23

#include <stdio.h>
int main()
{
	int M;
	long int a[90] = {1,2};
	for (int i = 2; i < 90; i++)
		a[i] = a[i - 1] + a[i - 2];
	while (scanf("%d", &M) != EOF && M != 0)
	{
		printf("%ld\n", a[M - 1]);
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 23