View Code of Problem 23

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

Double click to view unformatted code.


Back to problem 23