C/DeitelC/Chapter5/isPerfect.c
2025-05-07 14:05:25 +03:00

18 lines
214 B
C

#include <stdio.h>
int isPerfect(int);
int isPerfect(int num) {
int temp = 0;
for(int i = 1; i < num; i++) {
if(num % i == 0) {
temp += i;
}
}
if (temp == num) {
return 1;
} else {
return 0;
}
}