C++ 反转三位数
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int reverse = 0;
while (n > 0) {
int digit = n % 10;
reverse = reverse * 10 + digit;
n /= 10;
}
cout << reverse << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/uMC 著作权归作者所有。请勿转载和采集!