class Solution {

public:

```
bool isHappy(int n) {
int y,s;
s=count(n);
while (s>10){
s=count(s);
}
while(s<=10){
if (s==1||s==10)
{
return true;
}
else{
return false;
}
}
}
int count (int n){
int x=n;
int sum=0;
while (x){
sum=sum+(x%10)*(x%10);
x=x/10;
}
return sum;
}
```

};