#include <stdio.h>
int main() {
int num, sum = 0;
printf("Enter a positive integer: ");
scanf("%d", &num);
if (num <= 0) {
printf("Please enter a positive integer.\n");
} else {
// Find the sum of proper divisors
for (int i = 1; i <= num / 2; i++) {
if (num % i == 0) {
sum += i;
}
}
if (sum == num) {
printf("%d is a perfect number.\n", num);
} else {
printf("%d is not a perfect number.\n", num);
}
}
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: