C++代码:将整数分离为个位数字
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
while (n > 0) {
cout << n % 10 << ' '; // 输出个位数字
n /= 10; // 将整数除以10,移位到下一位
}
return 0;
}
原文地址: https://www.cveoy.top/t/topic/lGcz 著作权归作者所有。请勿转载和采集!