41.7k views
4 votes
Which for loop will iterate 100 times?

a-for(i=1;i<99;i++)
b-for(i=0;i< 100;i++)
c-for(i=1;i< 100;i++)
d-for(i=0;i< 99;i++)

1 Answer

4 votes

Final Answer:

The for loop that will iterate 100 times is c-for(i=1;i< 100;i++). Option C is answer.

Step-by-step explanation:

In a for loop, the three components are initialization, condition, and iteration. In the given options, option c initializes the loop with i=1, sets the condition as i<100, and increments i in each iteration. This loop structure ensures that the loop will run as long as i is less than 100. It starts from 1 and iterates until i reaches 99, completing a total of 100 iterations.

Option C (c-for(i=1;i< 100;i++)) is the answer, as it is the for loop that will iterate 100 times.

User Freefaller
by
8.7k points