258. Add Digits(E)

2016-03-21  本文已影响11人  BeijingIamback

Given a non-negative integer num, repeatedly add all its digits until the result has only one digit.

For example:

Given num = 38, the process is like: 3 + 8 = 11, 1 + 1 = 2. Since 2 has only one digit, return it.

代码1:

参考代码1

代码2:

数字的根

参考代码2
上一篇 下一篇

猜你喜欢

热点阅读