C Program to find perfect numbers below 1000 range - c programs
//write a C Program to find perfect numbers below 1000 range
//check perfect numbers below 1000 range
/C Program to find perfect numbers below 1000 range
#include<stdio.h>
void main(){
int n=1,i=1,sum=0;
while n<1000
{
while(i<n){
if(n%i==0)
sum=sum+i;
i++;
}
if(sum==n)
printf("\n %d ",i);
}
}
No comments:
Post a Comment