递归解法
2024-11-25 19:09:12
发布于:北京
24阅读
0回复
0点赞
#include <bits/stdc++.h>
using namespace std;
int n;
void f(int x){
if (x == 0){
return;
}
f(x / 10);
cout << x % 10 << endl;
}
int main(){
cin >> n;
f(n);
return 0;
}
注意:先递归,再输出,这应该知道是怎么回事吧(因为要从最高位开始)
这里空空如也
有帮助,赞一个