Post Top Ad

Your Ad Spot

Pages

Sunday, 9 February 2020

Write A Program To check Perfect NO OR NOT

#include<stdio.h>
#include<conio.h>

int IsPerfact(int no)
{
int i,res=0;
for(i=1;i<=no/2;i++)
{
if(no%i==0)
{
res=res+i;
}
}
return res==no;
}

 void main()
{         
  printf(" %d",IsPerfact(6));
  
}

No comments:

Post a Comment

Post Top Ad

Your Ad Spot

Pages