题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#include <iostream>
#include <string>
using namespace std;
int main() {
int n;
cin >> n;
string res = "";
if (n == 0) {
res = "0";
}
while (n > 0) {
res += (n % 10 + '0');
n = n / 10;
}
cout << res << endl;
return 0;
}
