85. To find perfect numbers
#include<stdio.h>
void
main()
{
int add,j,i,num,range;
printf("To find perfect numbers
\n");
printf("Enter the lower limit :
");
scanf("%d",&num);
printf("Enter the upper limit :
");
scanf("%d",&range);
for(num;num<range;num++)
{
for(i=1,add=0;i<num;i++)
if(num%i==0)
add=add+i;
if(add==num)
printf("%d ",add);
}
}
Comments
Post a Comment