write a c program to perform sum of digits until you get a single digit ( for two inputs) in c
Answers
Answered by
0
Answer:
If n < 10
digSum(n) = n
Else
digSum(n) = Sum(digSum(n))
example:Input : 1234
Output : 1
Explanation : The sum of 1+2+3+4 = 10,
digSum(x) == 10
Hence ans will be 1+0 = 1
Input : 5674
Output : 4
Similar questions