86. To find [y] number of perfect numbers starting from [x]
#include<stdio.h>
void
main()
{
int add,c,j,i,num,range;
printf("To find [y] number of perfect numbers starting from [x] \n");
printf("Enter the starting point :
");
scanf("%d",&num);
printf("How many perfect numbers
to find : ");
scanf("%d",&range);
for(num,c=1;c<=range;num++)
{
for(i=1,add=0;i<num;i++)
if(num%i==0)
add=add+i;
if(add==num)
{
printf("%d ",add);
c++;
}
}
printf("\n");
}
Comments
Post a Comment