View Code of Problem 23

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

    }
}

Double click to view unformatted code.


Back to problem 23