Tuesday, July 10, 2012

Perfect Number

Assalamu Alaikum. Hope you all are well by the grace of Almighty ALLAH. Today we learn how to find out the perfect number. Take a look at the problem.

Problem: A positive integer is entered through the keyboard. Write a program to determine whether the input number is a perfect number or not.



Solution:

A perfect number is one whose sum of factors is equal to the number like 6. 6 has three factors 1, 2, 3. When we add 1+ 2+ 3, it is equal to 6. Hence 6 is a perfect number. Likewise 28 is another perfect number.



Thank You all...


0 comments:

Post a Comment