View Code of Problem 23

#include<stdio.h>
#include<string.h>
#include<math.h>



int main(){
	
	int a[50]={1,2};
	for(int i=2;i<50;i++)a[i]=a[i-1]+a[i-2];
	int b;
	while(scanf("%d",&b)!=EOF)
	{
		if(b==0)return 0;
	
		printf("%d",a[b-1]);
	}
}

Double click to view unformatted code.


Back to problem 23