Question: Problem Description: In a magical land, there are 5 0 lights lined up in a row, all initially tumed off. A wizard visits the land
Problem Description:
In a magical land, there are lights lined up in a row, all initially tumed off. A wizard visits the land and performs the following enchantment:
On the first pass, the wizard toggles turns on if off, turns off if on every light. On the second pass, the wizard toggles every second light L L L On the third pass, the wizard toggles every third light dots This pattern continues until the wizard completes passes, toggling the th light. Write a program to simulate this enchantment and determine which lights are tumed on at the end.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
