题目:古典问题:有一对兔子,从出生后第3个月起每个月都生一对兔子,小兔子长到第三个月后每个月又生一对兔子,假如兔子都不死,问每个月的兔子总数为多少? #include <stdio.h> int main(void) { int months; //月数 int pre = 0; //前一个月数量 int cur = 1; //当前数量 int total; //总数量 int count; //计数器 printf("Enter the months: /n"); scanf("%d",&months); for (count = 1; count <= months; count++) { total = pre + cur; pre = cur; cur = total; } printf("Now there will %d rabbits./n",pre * 2); return 0; }