|
---|
|
---|
|
---|
C Program For PERFECT NUMBER.
void main()
{
int c=0,n,i;
clrscr();
printf("Enter n value:");
scanf("%d",&n);
for(i=1;i
{
if(n%i==0)
{
c=c+i;
}
}
if(n==c)
{
printf("given number %d is perfect number",c);
}
else
{
printf("not perfect number");
}
getch();
}
|
---|