#include<stdio.h>
int fib(int n);
int main()
{
int i,n,f1;
printf("Input Fibonacci's number:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
f1=fib(i);
printf("%6d",f1);
if(i%5==0)
printf("\n");
}
printf("\n");
}
int fib(int n)
{
int f;
if(n==1||n==2)
f=1;
else
f=fib(n-1)+fib(n-2);
return f;
}
运行结果: