#include<stdio.h>
int climb(n)
{
if(n==1)
return 1;
if(n==2)
return 2;
if(n>=3)
return climb(n-1)+climb(n-2);
}
void main()
{
int n;
printf("请输入楼梯的阶数:");
scanf("%d",&n);
printf("一共有%d种方法",climb(n));
}
06-13
3192
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
08-04
1万+
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
05-30