Given an integer N, recursively sum digits of N until we get a single digit. The process can be described below
If N < 10 digSum(N) = N Else digSum(N) = Sum(digSum(N))
Input : 1234 Output : 1 Explanation : The sum of 1+2+3+4 = 10, digSum(x) == 10 Hence ans will be 1+0 = 1
The first line contains an integer T, total number of test cases. Then following T lines contains an integer N.
Repeated sum of digits of N.
1 ≤ T ≤ 100
1 ≤ N ≤ 1000000
If you have purchased any course from GeeksforGeeks then please ask your doubt on course discussion forum. You will get quick replies from GFG Moderators there.