diff options
| author | verdant <im@verdant.ee> | 2026-06-30 12:11:38 +0800 |
|---|---|---|
| committer | verdant <im@verdant.ee> | 2026-06-30 12:11:38 +0800 |
| commit | 455316f1396e98e46fdd43b7fad479b68da1eac0 (patch) | |
| tree | 16648edf2c939005c888ae4bb246b91d5af09a7b /leetcode/0258 | |
| download | oj-455316f1396e98e46fdd43b7fad479b68da1eac0.tar.gz oj-455316f1396e98e46fdd43b7fad479b68da1eac0.zip | |
Diffstat (limited to 'leetcode/0258')
| -rw-r--r-- | leetcode/0258/main.c | 18 |
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; +} |
