https://www.codechef.com/YTPP001/problems/ISGOODNM

A number N is called **good** if the sum of the factors of N, less than N, is equal to the number N. Given a number N, check if it is good or not. Print **YES** if it’s a good number, otherwise print **NO** .

### Input:

- First-line will contain the number N.

### Output:

Print **YES** if N is good number, otherwise print **NO**.

### Constraints

- 1 ≤ N ≤ 10
^{10}

### Sample Input 1:

```
6
```

### Sample Output 1:

```
YES
```

### Sample Input 2:

```
16
```

### Sample Output 2:

```
NO
```

### EXPLANATION:

- In the first example, divisors of 6, less than 66 are 1,2,31,2,3, and (1+2+3)=6. Thus, 66 is a good number.
- In the second example, 16 is not a good number as (1+2+4+8)=15.

**My Solution**:

```
#include <iostream>
using namespace std;
int main()
{
int N, factorSum = 0;
cin >> N;
for (int i = 1; i < N; i++)
{
if (N % i == 0)
{
factorSum += i;
}
}
if (N == factorSum)
{
cout << "YES" << endl;
}
else
{
cout << "NO" << endl;
}
return 0;
}
```

I don’t know what I am doing wrong, please correct me.

Thanks!