258. Add Digits 發表於 2023-02-13 | 分類於 leetcode problemsolution12345678910111213141516class Solution {public: int addDigits(int num) { int n = num ; while(n>=10){ int sum = 0; while(n){ sum+=(n%10); n/=10; } n = sum; } return n; }};