输入一个三位自然数然后把这个数的百位数与个位数对调输出对调后的数输入格式输入一行只有一个整数 �100=�=999x100=x=999。输出格式输出只有一行包括 11 个整数。用C++做用C++做
#include <iostream>
using namespace std;
int main() {
int num;
cin >> num;
int hundreds = num / 100;
int tens = (num / 10) % 10;
int ones = num % 10;
int swappedNum = ones * 100 + tens * 10 + hundreds;
cout << swappedNum << endl;
return 0;
}
原文地址: https://www.cveoy.top/t/topic/iRqu 著作权归作者所有。请勿转载和采集!