# Algorithm to Check if Number is Perfect Number

[55 views]

### What is Perfect Number?

Perfect number is a positive integer equal to the sum of its proper divisors. Sum of its proper divisor excludes the Number itself. Ex. For number 6, the divisors are 1, 2, 3 and 6. Now if we take sum of 1, 2, 3 and exclude the number itself (i.e. 6), the sum is 6. Hence, 6 is a perfect number. 6 is the smallest Perfect Number. Let's check another number:
Input: 28
Divisors of 28: 1, 2, 4, 7, 14, 28
Sum of Divisors excluding 28: 1+2+4+7+14=28
Output: 28 is Perfect Number

### Algorithm to Check whether given number is Perfect Number:

1. Start 2. Read n 3. Initialize s=0 4. for i=1 to n do a. if(n%i)==0, then b. s=s+i 5. if s==n then Print "Given Number is Perfect Number". Goto Step 7 6. Print "Given Number is Not a Perfect Number" 7. Stop

## Algorithm Logic Test

Our Quiz prepared by Experts Helps you identify your knowledge in Algorithms. Everyone should atleast attempt this Quiz Once.

##### Algorithm Quiz

Only 5% Users were able to score above 75% in this Quiz. Can You Crack this?

##### Play 2048 Game Online and Relax. 