C program to check perfect number

This is the C program to check whether a number is a perfect number or not. The user enters a number as input and this program checks if it a perfect number or not.

Perfect number: A perfect number is a positive integer, that is equal to the sum of its positive factors, excluding the number itself. For example, the factors or proper divisors of 6 are 1, 2, 3 and 6. If we add 1, 2 and 3(excluding 6), we get 6, the number. Therefore 6 is a perfect number.

Program: C program to check whether a number is perfect or not.

Output: Print whether perfect or not

Enter a number: 36

36 is not a perfect number!!

Enter a number: 28

28 is a perfect number!!

Share your code and queries in the comments.

For more programming examples and code snippets, visit C programming examples.

Follow us on twitter to stay updated.

About ᴾᴿᴼᵍʳᵃᵐᵐᵉʳ

Linux and Python enthusiast, in love with open source since 2014, Writer at programming-articles.com, India.

View all posts by ᴾᴿᴼᵍʳᵃᵐᵐᵉʳ →

Leave a Reply

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