112k views
2 votes
How many times the following for loop will be executed? for (i=0; i<=10; i=i+3) document.write("Hello")

1 Answer

7 votes

Final answer:

The for loop will be executed 4 times.

Step-by-step explanation:

The given for loop will be executed 4 times. The loop starts with i=0 and continues until i is less than or equal to 10. In each iteration, the value of i is increased by 3. So, the values of i would be 0, 3, 6, and 9. Hence, the loop will execute 4 times.

User Shadrack
by
8.6k points