#include<stdio.h>
void main()
{
    int n,i=1,sum=0;
    printf("\n Enter 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);

}

 OUTPUT:

 Enter a Number : 6
 
6 is a Perfect Number