Perfect Number in C

Perfect Number in C

Here, you will know about perfect number and get the program source code to check perfect number in c programming. We will implement this program by using 2 different ways.

  1. using for loop 
  2. using function

What is perfect number in C?

A perfect number is a positive integer that is equal to the sum of its positive divisors, excluding itself. For example, 6 is a perfect number because it is equal to the sum of its divisors (1 + 2 + 3 = 6).

Perfect Number in C program

Output 1
Enter a number : 28
28 is a perfect number
Output 2
Enter a number:32
32 is not a perfect number

Perfect Number in C using Function

Output

Enter a Number : 6
6 is a perfect number.

Enter a Number : 40
40 is not a perfect number.

 

 

Check out our other C programming Examples

 

 

 

Leave a Comment

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

Scroll to Top