A lot of solutions I've seen so far either uses some sort of "Magic" number (which is impractical in real interviews because you wouldn't have unlimited time for observation or access to wikipedia), or uses very language specific features, so I decided to code up a general approach in both C and Python.

Here it goes:

C:

```
bool isHappy(int n) {
while (n >= 1) {
int res = 0;
while ((n / 10) >= 1) {
res += (n % 10) * (n % 10);
n /= 10;
}
n = res + (n % 10) * (n % 10);
if (n == 1) return true;
else if (n < 10) return false;
}
return false;
}
```

Python:

```
class Solution(object):
def isHappy(self, n):
"""
:type n: int
:rtype: bool
"""
while (n >= 1):
res = 0
while ((n / 10) >= 1):
res += (n % 10)*(n % 10)
n /= 10
n = res + (n % 10)*(n % 10)
if (n == 1):
return True
elif (n < 10):
return False
return False
```