Answer :
#include<stdio.h> //header file contains the function,decleraction and macro defination of key words used in code.
int main ()
{
int num,i,sum=0; //adressing the variables
printf("Enter the you want to check that it is perfect or not : "); //output
scanf("%d",&num);
for (i=1;i<num;i++) //condition
{
if (num%i==0) //condition
{
sum=sum+i;
}
}
if (sum==num) //condition
{
printf("%d is the perfect number ",num); //output
}
else
{
printf("%d is not the perfect number ",num); //output
}
}
Output :
0 Comments