C program to find the perfect number

In this tutorial, we will see about perfect number in C.
Perfect number is the postive number which is equal to the sum of all its divisors excluding itself.
For example:
28 is a perfect number because
Divisors of 28 are: 1,2,4,7 and 14 and its sum is equal to 28(1+2+4+7+14)


Enter a number:28
28 is Perfect Number

Enter a number:35
35 is Perfect Number


You just need to find the divisors of number and check if sum of divisors is equal to the number or not.

That’s all about perfect number in c.

Leave a Reply

Your email address will not be published. Required fields are marked *