Website Summary Files Commits Branches @commit @diff @stats
path: root / Week05 / Exercise07.cpp
blob: 350747b6b98183ee18d705fccb4729ba2f58c881 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <iostream>

int main() {
    unsigned int number;
    std::cin >> number;

    unsigned int sum = 0;
    for (int div = 1; div < number; div++) {
        if (number % div == 0)
            sum += div;
    }

    if (sum == number)
        std::cout << "Perfect" << std::endl;
    else
        std::cout << "Not perfect" << std::endl;

    return 0;
}