```
class Solution {
public:
bool checkPerfectNumber(int num) {
if(num <= 1) return false;
int sum = 0;
int i = 1;
while(i <= sqrt(num)){
if(num % i == 0){
sum += i + num / i;
}
i = i + 1;
}
return (sum - num) == num;
}
};
```