Digit Decomposition


Submit solution

Points: 45 (partial)
Time limit: 1.0s
Memory limit: 64M

Authors:
Problem type

題目說明

請設計一個程式,輸入一個整數,範圍必須在 0 ~ 9999 之間(包含 0 和 9999)。

若輸入數值超出範圍,輸出"wrong!",並結束程式。 若輸入數值在範圍內,則輸出該數的 個位、十位、百位、千位(若沒有該位數,則顯示 0)。

輸入

一行輸入 一個整數。

輸出

若輸入超過範圍,輸出wrong!
若輸入合法,依照格式輸出個位、十位、百位、千位

範例輸入 #1

1234

範例輸出 #1

Thousands : 1
Hundreds : 2
Tens : 3
Ones : 4

範例輸入 #2

9

範例輸出 #2

Thousands : 0
Hundreds : 0
Tens : 0
Ones : 9

範例輸入 #3

-10000

範例輸出 #3

wrong!

Comments

There are no comments at the moment.