题解 | #统计每个月兔子的总数#
统计每个月兔子的总数
https://www.nowcoder.com/practice/1221ec77125d4370833fd3ad5ba72395
#include <stdio.h> int main() { int a=0, b=2; scanf("%d",&a); int num1 = 1,num2 = 1,num3 = 0; if(a<=2) { printf("%d",num1); } else { while(b<a) { num3 = num1+num2; num1 = num2; num2 = num3; b++; } printf("%d",num3); } return 0; }