-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path382.cpp
More file actions
36 lines (34 loc) · 741 Bytes
/
382.cpp
File metadata and controls
36 lines (34 loc) · 741 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bits/stdc++.h>
int check(int n) {
int i, j, count = 1;
for (i = 2; i * i <= n; i++) {
if (n % i == 0) {
j = n / i;
if (i == j)
count += i;
else
count += i + j;
}
}
return count;
}
int main() {
int n, i, j;
printf("PERFECTION OUTPUT\n");
while (scanf("%d", &n)) {
if (n == 0) {
printf("END OF OUTPUT\n");
return 0;
}
printf("%5d ", n);
i = check(n);
if (i == n && n != 1) {
printf("PERFECT\n");
} else if (i > n) {
printf("ABUNDANT\n");
} else {
printf("DEFICIENT\n");
}
}
return 0;
}