Computer Science, asked by geetamishra965, 7 months ago

How many times is the loop executed?

int i=0, j=0;

do

{ i+=j;

}

While(j<5);

please answer fast​

Answers

Answered by Anonymous
0

Answer:

often need to repeat actions.

For example, outputting goods from a list one after another or just running the same code for each number from 1 to 10.

Loops are a way to repeat the same code multiple times.

The “while” loop

The while loop has the following syntax:

while (condition) {

// code

// so-called "loop body"

}

While the condition is truthy, the code from the loop body is executed.

For instance, the loop below outputs i while i < 3:

let i = 0;

while (i < 3) { // shows 0, then 1, then 2

alert( i );

i++;

}

Answered by lugie
0

Answer:

The loop will be executed until the value of j less than 5, But there is pre or post increment used.

i=i+j ;

 // no increment operator is used for the running variable

let's assume ,

j=j+i

j=0+0

j=0;

which makes indefinite condition it neither gives zero not error..

just include a count variable to understand this much better.

int i=0, j=0;

int count=0;

do

{

i+=j;    i=i+j;

count ++;

}

while(j<5);

Similar questions