aboutsummaryrefslogtreecommitdiffstats
path: root/leetcode/0258/main.c
blob: 488e06e303fe22856cf02ce0c68affb7d15ccc6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#include <stdio.h>
int addDigits(int num) {
    while (num >= 10) {
	int sum = 0;
	while (sum > 0) {
	    sum += num % 10;
	    num /= 10;
	}
	num = sum;
    }

    return num;
}


int main() {
   return 0;
}