The Pronic Navigator
EasyAcc. 97.2%
+15 XP 5
Perfect Pairings
A Pronic Number (or heteromecic number) is a number that is the product of two consecutive integers, $n imes (n+1)$. Example: $12$ ($3 imes 4$), $6$ ($2 imes 3$).
The Assignment
Your function receives a parameter num.
- Use a loop starting from 0 up to the square root of
num. - Check if the product of the current index
iandi + 1equalsnum. - Print "true" if you find a match, otherwise "false".
01EXAMPLE 1
Input
num = 12Output
trueExplanation: 3 * 4 = 12.
Constraints
- Use a single loop.
- Handle zero as a pronic number (0 * 1).
MathLoops
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
num12
Expected Output
true
Click RUN to test your solution