每日一题洛谷P1307 [NOIP2011 普及组] 数字反转c++
#include<iostream>
using namespace std;
int main() {
int n;
cin >> n;
if (n) {
int m = 0;
while (n) {
m = m * 10 + n % 10;
n /= 10;
}
cout << m << endl;
}
else {
cout << n << endl;
}
return 0;
}