TO DISPLAY ALL PERFECT NUMBERS BETWEEN 1 TO 50 BY USING FUNCTION


#include<stdio.h>
void main()
{
int i, sum, num;
for(num = 1; num < 50; num++)
{
for(i = 1, sum = 0; i < num; i++)
{
if(num % i == 0)
sum += i;
}
if(sum == num)
printf("%d ",num);
}
}

2 comments: (+add yours?)

TurnToYourInnerSmile Blog said...

Greetings! Do you usually use online social websites?

Siraj Shaikh said...

facebook

Post a Comment