Iteration count of a guarded nested loop
An outer loop runs from to . Only when is even does an inner loop run, executing from to ; on odd the inner loop is skipped entirely. For , how many inner-loop iterations execute in total?
Show hints (2)+
- Only even trigger the inner loop, which then runs times.
- Sum , not .
Answer
Reveal answer →Final answer
30
Want the full step-by-step worked solution? It's part of Premium - along with a worked solution for every question in the bank.
Asked at: Timed Mental-Math & Sequences, Game-Based Aptitude