#include<stdio.h>
#include<conio.h>
void main()
{
int n,i,sum=0,flag=0;
clrscr();
printf("Enter the number::\n");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
flag=1;
if(flag==1)
printf("its a Perfect number");
else
printf("its Not Perfect number");
getch();
}
#include<conio.h>
void main()
{
int n,i,sum=0,flag=0;
clrscr();
printf("Enter the number::\n");
scanf("%d",&n);
for(i=1;i<=n/2;i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
flag=1;
if(flag==1)
printf("its a Perfect number");
else
printf("its Not Perfect number");
getch();
}
No comments:
Post a Comment