each unit numbers?
題目說明
輸入一數 範圍在0~9999
若輸入在範圍外輸出wrong!
並結束程式(System.exit(0);
)
若在範圍內則輸出個十百千位數各為多少
輸入限制: 0<=輸入值<10000
輸入
一整數(int)
輸出
個十百千位數分別為多少
輸出部分需在程式碼中插入"\n"
如System.out.print("thousand:"+千位數+"\nhundred:"+百位數+"\nten:"+十位數+"\ndigit:"+個位數)
sample input1
520
sample output1
thousand:0
hundred:5
ten:2
digit:0
sample input2
10000
sample output2
wrong!
提示: 運用%
, /
來求數值各位數
Comments