Write a program to identify whether the given number is a perfect number or not. 28 is a perfect number.

#include<stdio.h>
int main()
{
int i,sum=0,n;
printf("enter the numbers:");
scanf("%d", &n);
for(i=1;i<=n/2;i++)
{
if(n%i==0)
{
sum=sum+i;
}
}
if(sum==n)
{
printf("%d is a perfect number",n);
}
else
printf("%d is not a perfect number",n);
return 0;
}

Comments

  1. We have greater than 100 slot video games 카지노사이트 that settle for each temper, selection, and interest

    ReplyDelete

Post a Comment

Popular posts from this blog