Program for print Perfect numbers with in given range

# include<stdio.h> #include<conio.h> void maim() { int i, j, s, e, sum ; clrscr(); printf ( “enter range start &...

# include<stdio.h>
#include<conio.h>
void maim()
{
int i, j, s, e, sum ;
clrscr();
printf ( “enter range start & end”);
scanf (%d% d", & s, & e);
for ( i = s , i < = e; i++)
sum=0;
for(j=1;j<=i/2;j++)
{
  if ( i %j = = 0)
  sum = sum + j;
}
if ( sum = = i)
printf ( “%d \n “, i);
getch();
}

Out put:

enter range start & end 10 1000
28
496

Related

C Programs 4376032506949670404

Post a Comment

emo-but-icon

item