The Abundant Number
MediumAcc. 94.2%
+20 XP 8
Overwhelming Factors
An Abundant Number is a number where the sum of its proper divisors is greater than the number itself. Example: 12 (Divisors 1, 2, 3, 4, 6 $ o$ sum = 16. $16 > 12$, so it is abundant).
The Assignment
Your function receives a parameter num.
- Calculate the sum of proper divisors (using a loop).
- If the sum is greater than
num, print "true", otherwise "false".
01EXAMPLE 1
Input
num=12Output
trueExplanation: Sum of divisors is 16.
Constraints
- Use a loop to find divisors.
- Do not include the number itself.
MathLoops
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
num12
Expected Output
true
Click RUN to test your solution