斐波那契数问题 怎么才是把输入的n项全部打不来 而不是只打第n项
#include<stdio.h>int main (void)
{
int f1,f2,f3;
int n =1,i;
while ( n != 0)
{
f1 = 1;
f2 = 1;
scanf("%d",&n);
if (n ==1)
{
printf("第%d个值为:%d\n",n,f1);
}
else if (n == 2)
{
printf("第%d个值为:%d\n",n,f2);
}
else if (n >= 3)
{
for(i = 3; i <=n; i++)
{
f3 = f1 + f2;
f1 = f2;
f2 = f3;
}
printf("第%d个值为:%d\n",n,f3);
}
}
return 0;
}