#include <solution/258.h>

int addDigits(int num)
{
    do
    {
        int n = 0;
        while (num)
        {
            n += num % 10;
            num /= 10;
        }
        num = n;
    } while (num >= 10);
    return num;
}
