- 1
How many times will the following loop execute? Explain.
How many times will the following loop execute? int x = 1; while (x++ < 5) { if (x % 2 == 0) x += 2; }
2 Respostas
+ 1
int x = 1, c=0;
while (x++ < 5)
{
if (x % 2 == 0)
x += 2;
++c;
}
cout<<c;
it will execute c times.
0
2 times