Tux Education Our New Education Channel Please Share And Subscribe It...

/* Find Out The Perfect Number */


// Compiler : Dev C++4.9.9.2

#include<stdio.h>

int main()
{
    int n,i=1,sum=0;
    
    printf("Number : ");
    scanf("%d",&n);
    
    while(i<n)
    {
           if(n%i==0)
           sum+=i;
           
           i++;
    }
    
    if(sum==n)
    printf("\n\n%d Is Perfect Number.",i);
    else
    printf("\n\n%d Is Not Perfect Number.",i);
    
    getch();
    return 0;
}

Post a Comment