Computer Science, asked by jojo72, 9 months ago

How to exit a premature loop?

Answers

Answered by rajchauhan404077
2

Answer:

In a simple loop, the test expression is the sole factor that determines when the loop stops. When the test expression of a simple loop yields false, the loop terminates. However, as loops become more complex, we may need to arbitrarily terminate a running loop regardless of the value of the test expression. To do so, we use the break and continue statement.........

Answered by prakhargupta3301
1

An example:

int main()

{

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

{

cout<<i<<endl;

break;

}

}

Output:

1

Similar questions