```
class Solution {
public:
bool isHappy(int n) {
if(sumValue(n)<10){
if(sumValue(n)==1)
return true;
else
return false;
}
else{
return isHappy(sumValue(n));
}
}
int sumValue(int n){
int sum = 0;
while(n){
sum += (n%10)*(n%10);
n = n/10;
}
return sum;
}
};
```