题解 | 反向输出一个四位数
反向输出一个四位数
https://www.nowcoder.com/practice/1f7c1d67446e4361bf4af67c08e0b8b0
#include <iostream>
using namespace std;
int main() {
int n;
cin >> n;
int thousand = n / 1000;
int hundred = (n / 100) % 10;
int ten = (n / 10) % 10;
int one = n % 10;
cout << one << ten << hundred << thousand << endl;
}
// 64 位输出请用 printf("%lld")

查看17道真题和解析