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.

  1. Use a loop starting from 0 up to the square root of num.
  2. Check if the product of the current index i and i + 1 equals num.
  3. Print "true" if you find a match, otherwise "false".

01EXAMPLE 1

Inputnum = 12
Outputtrue

Explanation: 3 * 4 = 12.

Constraints

  • Use a single loop.
  • Handle zero as a pronic number (0 * 1).
MathLoops
JavaScript
Loading...
3 Hidden

Input Arguments

num12

Expected Output

true

Click RUN to test your solution