Fibonacci Method Turbo C

#include <stdio.h>
int main(void)
{
long f0=0, f1=1,n,temp,limit;
printf("Enter the limit number:");
scanf("%i",&limit);
printf("the fibonnacci number are:\n");
printf("1\n");
    for (n=2;n<=limit;++n) {
        temp=f1;
        f1+=f0;
        f0=temp;
printf("%i\n",f1);
    }
return 0;
}


0 comments :

Post a Comment

 
My IT Life © 2011-2014|Gene Rose