aboutsummaryrefslogtreecommitdiffstats
path: root/leetcode/0258/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'leetcode/0258/main.c')
-rw-r--r--leetcode/0258/main.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/leetcode/0258/main.c b/leetcode/0258/main.c
new file mode 100644
index 0000000..488e06e
--- /dev/null
+++ b/leetcode/0258/main.c
@@ -0,0 +1,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;
+}