Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 408 Bytes

AddDigits.md

File metadata and controls

32 lines (22 loc) · 408 Bytes

AddDigits

Difficulty Tags Solution Link
Medium [Integers] To Do

Problem Description

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

38
3 + 8 = 11
1 + 1 = 2
// return 2


5419
5 + 4 + 1 + 9 = 19
1 + 9 = 10
1 + 0 = 1
// return 1

Sample

Input Output
38 2
5419 1