Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <math.h>
- using namespace std;
- bool dividersSum(int n) {
- int nn = n;
- int result = 0;
- for (int i = n-1; i > 1; i--) {
- if (n % i == 0) {
- result += i;
- }
- }
- return result + 1 == nn;
- }
- int main()
- {
- setlocale(LC_ALL, "ru");
- int n;
- cin >> n;
- if (dividersSum(n)) {
- cout << "СОВЕРШЕННОЕ";
- }
- else {
- cout << "НЕ СОВЕРШЕННОЕ";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement