answersLogoWhite

0


Best Answer

If you are speaking of while loops, this might be the answer for you.

Example 1:

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

{

}

Example 2:

do

{

i++;

} while (i < 100);

or even

Example 3:

while (i < 100)

{

i++;

}

This finalization of loops can be done with many conditions. These examples contain only counter. There are many other ways to make an infinite loop finite.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Which mechanism can be use to avoid a count-to-infinity loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does an electric eel use its electricity for?

It is used as both a defensive mechanism to avoid predators, and an offensive mechanism when they are hunting.


Is substance use a negative coping mechanism to avoid fear?

Yes it is.


What is loop checking in dcs explain with diagram?

its nothing but just to loop and check the answer with the corresponding alpha co-ordinate. It can also be simply under stood as the way of checking the mechanism with the use of loop. And the point to be noted is that all loop check are reversible up to a limit. Just press F4.


What is the purpose of flaming the loop before and after use?

Inoculating loop is used to inoculate microbial colony or sample on culture medium and to avoid the undesired microbial cells or to avoid contamination flaming of inoculating loop is necessary it is also called as incerination.


What is the main use for the pid controller?

The main use for the pid controller is to be a generic control loop feed back mechanism (the controller) and the pid controller is widely used in all areas of the world.


For loop -uses?

You can use a for loop whenever you can use a while loop; it's the same.


Why you use if loop in telecoms?

No such thing as if-loop. if-else statement is not a loop.


Is it possible to use a for loop in place of a while loop?

Yes. while loop consist of only condition statement to make for loop look as while loop we can use syntax shown below: for(;condition;) eg: for(;i&lt;=n;)


Why you use for loop inside switch statement?

Because you have to repeat something. (Or you can use while-loop, too.)


Why you need a for loop when you have already while loop or do while loop?

We need a for loop because the while and do-while loops do not make use of a control variable. Although you can implement a counter inside a while or do-while loop, the use of a control variable is not as self-evident as it is in a for loop. Aside from the use of a control variable, a for loop is largely the same as a while loop. However, it is quite different to a do-while loop, which always executes at least one iteration of the loop before evaluating the conditional expression. In a for and while loop, the conditional expression is always evaluated before entering the loop, which may result in the loop not executing at all.


Is there any rule that if I use an If in a loop then i cant use that if in another loop?

If your question makes sense at all, and it is about programming, then the answer is no.


Why you use inner loop and outer loop?

Sometimes you have to use nested loops, in this case one of them is the outer, the other is the inner.