# C program to find the sum of digits of a number until a single digit is occurred

In general , we use loop or recursion to traverse each digit of the number and to add them .But it is a complex method (with time complexity O(n)) in comparison to the method describe below (with time complexity O(1)).

**Input:** 987654
**Output: ** 3

Program:

need an explanation for this answer? contact us directly to get an explanation for this answerOutput: