Numerology


Submit solution

Points: 10
Time limit: 2.0s
Memory limit: 64M

Author:
Problem types
Allowed languages
Java 19, Java 8

題目說明

生命靈數為將生日日月年每位數相加,若高於兩位數則重複加總每位數,直到加總後為個位數為止。
例如: 20051003生日的人,生命靈數為: 2+0+0+5+1+0+0+3 = 11, 因為尚未達到個位數,因此要再加總 1 + 1 = 2。 因此生命靈數為2。

請使用者輸入生日 (yyyymmdd),並幫他計算他的生命靈數。

本題請使用while來完成!

輸入

生日 西元年月日 (yyyymmdd)

輸出

使用者之生命靈數

sample input & output

輸入 輸出
DataSet1 20060901 9
DataSet2 20050928 8
DataSet3 20060210 2
DataSet4 19990919 2
DataSet5 20051103 3

Comments

There are no comments at the moment.