Computer Science, asked by myasser96333, 9 months ago

How many times this loop will execute? *

for(int i=0;i<10;i++)

{i=i*2;

i--;

}

Answers

Answered by choudharykhushi176
9

Answer:

It is an infinite loop

Explanation:

because you are initializing i=0 and then multiplying i with 2 which will be 0.

The condition will always be true as <10.

Answered by greeshmakachirayil
0

Answer:

It is an infinite loop because i is set equal to 0, i=0, and then multiplied by 2, which equals 0.

The condition is always true because <10.

An infinite loop (or endless loop) is a set of instructions in computer programming that will run indefinitely unless interrupted by an external event ("pull the plug"). It might be deliberate.

An infinite loop is a series of instructions in a computer program that continues indefinitely, either because the loop lacks a terminating condition, has one that can never be satisfied, or causes the loop to restart. In previous cooperative multitasking operating systems, endless loops would generally cause the entire system to become unusable.

Under the now-common preemptive multitasking approach, endless loops often cause the application to use all available CPU time, although they may normally be canceled by the user. Busy wait loops are also known as "infinite loops" at times. One probable reason for a computer "stopping" is infinite loops; others include thrashing, deadlock, and access violations.

Learn more about loops here:

https://brainly.in/question/607496

Learn more about definite loops here:

https://brainly.in/question/22921130

#SPJ2

Similar questions