#include<stdio.h>
#include<conio.h>
main()
{
int i,num,sum;
clrscr();
printf("\n\n Enter a number : ");
scanf("%d",&num);
i = 1;
sum = 0;
while(i < num)
{
if(num % i == 0)
sum = sum + i;
i++;
}
if(sum != num)
printf("\n The entered number %d is NOT A PERFECT NUMBER",num);
else
printf("\n The entered number %d is A PERFECT NUMBER",num);
return 0;
}
No comments:
Post a Comment