# c++ program to check whether a given number is a perfect number or not

Write a c++ program to check whether a given number is a perfect number or not.

## C++ Source code of the perfect number

Output

enter the num 5

5 is a perfect number

## Excercise

Find the possible mistakes in the following Shamil’s Flow Table of the program to check whether a given number is a perfect number or not.

 loop Line which executed Actual work to  do I=1 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25, 16 N%i==06%1==0Sum=sum+iSum=0+1=1 I=2 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25,16,17,11,12,13,14,25,16, N%i==06%2==0Sum=sum+iSum=1+2=3 I=3 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25,16,17,11,12,13,14,25,16,17,11,12,13,14,25,16, N%i==06%3==0Sum=sum+iSum=3+3=6 I=4 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25,16,17,11,12,13,14,25,16,17,11,12,13,14,25,16,17,18 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 25,16,17,11,12,13,14,25,16,17,11,12,13,14,25,16,17,18,19,20,21,26,27 Sum=6Is a perfect number