View Code of Problem 23

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

Double click to view unformatted code.


Back to problem 23