```
bool judgeSquareSum(int c) {
for(int i=0;i<= (int)sqrt(c);++i)
if(is_perfect_square(c-i*i)) // check if the number is a perfect square
return true;
return false;
}
bool is_perfect_square(int num){
int sq = sqrt(num);
return sq*sq == num; //return true if perfect square
}
```