class Solution {
public:
int Add(int obj)
{
int temp=0;
while(obj)
{
temp+=obj%10;
obj=(obj-obj%10)/10;
}
return temp;
}
int addDigits(int num) {
while(num/10)
{
num=Add(num);
}
return num;
}
};
class Solution {
public:
int Add(int obj)
{
int temp=0;
while(obj)
{
temp+=obj%10;
obj=(obj-obj%10)/10;
}
return temp;
}
int addDigits(int num) {
while(num/10)
{
num=Add(num);
}
return num;
}
};