注意:
(1)特殊情况n为1或2时
(2)不要用重复变量(在i时)
include[HTML_REMOVED]
using namespace std;
int main()
{
int n,c,a=0,b=1,i;
scanf(“%d”,&n);
printf(“0 “);
if(n>=2)
printf(“1 “);
if(n>=3)
{
for(i=3;i<=n;i++)
{
c=a+b;
printf(“%d “,c);
a=b;
b=c;
}
}
return 0;
}