Program to check whether the given no is Perfect number or not
https://www.computersprofessor.com/2016/06/program-to-check-whether-given-no-is.html?m=0
#include<stdio.h>
#include<conio.h>
main()
{
int n, i , c = 0;
printf (“enter a number”);
scanf (“ %d”, & n);
for (i=1; i < = n/2; i++)
{
If(n%i==0)
c=c+i;
}
if (c==n)
printf (“perfect number”);
else
printf (“not a perfect number”);
getch();
}
Out
Put:
Enter a no 89
Not a perfect number
Enter a no 6
Perfect number