Program to cheque enter number is a perfect number or not in C-language
#include<stdio.h>
int main()
{
int a,i,s=0;
printf("Enter the number\n");
scanf("%d",&a);
for(i=1;i<a;i++)
{
if(a%i==0)
{
s=s+i;
}
}
if(s==a)
{
printf("Enter number is perfect number");
}
else
{
printf("Enter number is not perfect number");
}
}
OUTPUT
Enter the number
28
Enter number is perfect number
This program help you to cheque enter number is
perfect number or not and also this program help you to make logics of coming program.
If you like this program then you can share it and for any issues you can direct contact with me from Home Page.
For regular updates you can also follow my site.
Visit Homepage
Comments
Post a Comment