Thursday, September 24, 2009

Perfect No

here is the program check whether no. is perfect no. or not. If additon of all smaller no.s that divide the target_no perfectly also smaller than target_no is equal to target_no, then target_no is called as perfect no. i.e

Eg: take no. 6(target_no)
what're smaller no. of 6?
1,2,3,4,5
which no.s divide the 6 perfectly?
1,2,3
Addition of dividing no.s:
1+2+3=6(result)
now result=target_no ,so 6 is target no.
Here is the simple program to check whether the target is perfect or not.

0 comments:

Post a Comment