把下面的代码转成c++:m,n=map(int,input().split()) a=1 b=1 for i in range(2,n-m+1): c=a+b a=b b=c print(b)
时间: 2024-05-01 19:19:26 浏览: 88
Java转C++代码工具 J2C
5星 · 资源好评率100%
把下面的代码转成c:
```
#include <stdio.h>
int main()
{
int m, n;
scanf("%d %d", &m, &n);
int a = 1, b = 1;
for (int i = 2; i < n - m + 1; i++)
{
int c = a + b;
a = b;
b = c;
}
printf("%d\n", b);
return 0;
}
```
阅读全文