Last One Standing

3

1 votes
Medium
Problem

This problem is all about finding the sum of digits of a number until the number is a single digit. You have to keep on calculating the sum of digits of an entered number until the number comes to be a single digit.

INPUT The input will contain an integer type number.

OUTPUT For each test case, print the sum of digits of an entered number until the number comes to be a single digit.

Time Limit: 5
Memory Limit: 256
Source Limit:
Explanation

Test Case 1:-

Input:- 147

        1+4+7 = 12     =>      1+2=3

Output:- 3


Test Case 2:-

Input:- 3546

        3+5+4+6 = 18     =>     1+8=9

Output:- 9

Editor Image

?