程序代码:
#include<stdio.h>
#define NUM 13
int main()
{
int i;
long fib[NUM] = {1,1};
for(i=2;i<NUM;i++){
fib[i] = fib[i-1]+fib[i-2];
printf("%d月的兔子总数为:%d\n",i-1,fib[i]);
}
return 0;
}
结果截图:
2024-03-24 22:05:10
程序代码:
#include<stdio.h>
#define NUM 13
int main()
{
int i;
long fib[NUM] = {1,1};
for(i=2;i<NUM;i++){
fib[i] = fib[i-1]+fib[i-2];
printf("%d月的兔子总数为:%d\n",i-1,fib[i]);
}
return 0;
}
结果截图: