65. Number is perfect number or not
#include<stdio.h>
void
main()
{
int i,num,add=0;
printf("Number is perfect number
or not\n");
printf("Enter the number :");
scanf("%d",&num);
for(i=1;i<num;i++)
{
if(num%i==0)
{
add=add+i;
}
}
if(add==num)
printf("Its a perfect
number\n");
else
printf("Its not a perfect
number\n");
}
Comments
Post a Comment