# [258. Add Digits](https://leetcode.com/problems/add-digits/description/)
# 思路
没什么好说的，按照题目的意思，用两个while循环即可。
# C++
``` C++
class Solution {
public:
    int addDigits(int num) {
        int res = 0;
        while(num >= 10){
            while(num > 0){
                res += (num % 10);
                num /= 10;
            }
            num = res;
            res = 0;
        }
        return num;
    }
};
```
