#include "stdio.h"
long int fibonacci(int count)
{
static long int f1=1,f2=2,f;
if(count<3)
f=1;
else
f=f1+f2;
f1=f2;
f2=f;
}
int main (void)
{
int count,n;
printf("How many fibonacci numbers?");
scanf("%d",&n);
for(count=1;count<=n;++count)
printf("i=%d F=%ld\n",count,fibonacci(count));
system("pause");
return 0;
}
0 comments:
Post a Comment