###### tags: `實習題目` `大一程設` `東華大學` `東華大學資管系` `基本程式概念` `資管經驗分享` 數字倒轉 === ## Description: 讀入一個四位數,把它反轉後輸出。 ### 限制: **禁止使用字串處理,不然就太簡單了** ### 提示: 1. 此題可不用到任何條件判斷式 2. 有某一個**做數學**的運算子非常重要 ## Input: 一個四位數的數字,第一位數不會是0。 ## Output: 反轉後的四位數 ## Sample Input `1234` ## Sample Output `4321` <!-- ## 範例解答 ```cpp= #include <iostream> using namespace std; int main(int argc, char** argv) { int target = 0; int ans = 0; int a,b,c,d; cin >> target; a = target / 1000; b = (target % 1000) / 100; c = (target % 1000 % 100) / 10; d = (target % 1000 % 100 % 10); ans = d * 1000 + c * 100 + b * 10 + a * 1; cout << ans; return 0; } ``` -->