#include<stdio.h>
void trade (a,b,c)
{
b=c;
a=b;
}
main()
{
int n,i,fbn,fbn1,fbn2;
printf("please input the month which you want to know:");
scanf("%d\n",&n);
if(n>13 || n<1)
printf("error due to the wrong input !\n");
else if(n==1|| n==2)
printf("the total number of the rabbits are 1.\n");
else
fbn1=fbn2=1;
for(i=3;i<=n;i++)
{
fbn=fbn1+fbn2;
fbn2=fbn1;
fbn1=fbn;
}
printf("the final number of the rabbits is :%d",fbn);
}
正文
兔子繁殖问题2005-04-02 20:39:00
【评论】 【打印】 【字体:大 中 小】 本文链接:http://blog.pfan.cn/jay0518/449.html
阅读(4829) | 评论(0)
版权声明:编程爱好者网站为此博客服务提供商,如本文牵涉到版权问题,编程爱好者网站不承担相关责任,如有版权问题请直接与本文作者联系解决。谢谢!
评论