#include<stdio.h>
int main ()
{
int n, i = 1, sum = 0;
printf ("\nEnter a Number : ");
scanf ("%d", &n);
while (i < n)
{
if (n % i == 0)
sum = sum + i;
i++;
}
if (sum == n)
printf ("%d is a Perfect Number", i);
else
printf ("%d is Not a Perfect Number", i);
return 0;
}
OUTPUT:
Enter a Number : 6 6 is a Perfect Number