Computer Science, asked by dharmendrasahu38, 4 months ago


Q5. Write a function to accept any sumber using parameter and print whether the number la perfect
number or not. Call this function into main function
Perfect Number: A number is said to be perfect if eum of all facton excluding sumber itself is equal
to the original number​

Answers

Answered by meharakshitha4
2
A number is a perfect number if is equal to sum of its proper divisors, that is, sum of its positive divisors excluding the number itself. Write a function to check if a given number is perfect or not.

Examples:

Input: n = 15
Output: false
Divisors of 15 are 1, 3 and 5. Sum of
divisors is 9 which is not equal to 15.

Input: n = 6
Output: true
Divisors of 6 are 1, 2 and 3. Sum of
divisors is 6.
Similar questions