题解 | #数字颠倒#
数字颠倒
https://www.nowcoder.com/practice/ae809795fca34687a48b172186e3dafe
#include <iostream>
#include <string>
int main(int argc, char* argv[]){
int n;
std::cin >> n;
if(n == 0){
std::cout << 0 << std::endl;
}
std::string s;
while(n != 0){
s.push_back(n % 10 + '0');
n /= 10;
}
std::cout << s << std::endl;
return 0;
}
