#include < stdio.h >
#include < conio.h >
void main()
{
int n,d,tot;
clrscr();
printf("\n Enter value for n : ");
scanf("%d",&n);
tot = 0;
d = 1;
while ( d<= n/2)
{
if ( n % d == 0 )
{
tot = tot + d;
}
d++;
} // while
if ( tot == n )
{
printf("\n Yes... %d is perfect",n);
}
else
{
printf("\n Ohhhh... %d is not perfect",n);
}
}
No comments:
Post a Comment