#include<stdio.h>
main()
{
int n,i=1,s=0;
printf("\n Enter the number");
scanf("%d",&n);
do
{
if(n%i==0)
{
s=s+i;
}
i++;
if(s>n)
break;
}while(i<n);
if(s==n)
printf("\n %d is perfect number",n);
else
printf("\n %d is not perfect number",n);
getch();
}
No comments:
Post a Comment