The Divisibility Scanner
MediumAcc. 91.4%
+30 XP 12
Range Scanning
Nested loops are the engine of data analysis. By cycling through a list of targets and checking each against a list of rules (like divisors), you can find complex patterns.
The Assignment
Your function receives parameters startRange, endRange, minDivisor, and maxDivisor.
- Write an outer
forloop (target) that cycles fromstartRangetoendRange. - Write an inner
forloop (divisor) that cycles fromminDivisortomaxDivisor. - Inside the inner loop, check if
target % divisor === 0. - If true, print: "Target " + target + " is divisible by " + divisor
01EXAMPLE 1
Input
start=10, end=12Output
Target 10 is divisible by 2
Target 12 is divisible by 2
Target 12 is divisible by 3Explanation: Checks each number against 2 and 3.
Constraints
- Use nested for loops.
- Correct string formatting for the log.
LoopsFundamentalsMath
JavaScriptSystem handles I/O — write your function only
Loading...
3 Hidden
Input Arguments
startRange10
endRange12
minDivisor2
maxDivisor3
Expected Output
Target 10 is divisible by 2 Target 12 is divisible by 2 Target 12 is divisible by 3
Click RUN to test your solution