Counter control structure
Counter control structure is defined as a control structure in which control is executed in a loop or we can say that sequentially upto certain condition is true.
There are three loops in C:-
- While loop
- do while loop
- For loop
increment or decrement condition;
When number 6 is entered by user then loop does not execute because condition is false as number>5.
In this control structure condition is test first then loop execute up to that condition is true, as the condition false control turn out of the loop.
Do while loop
In this type of control structure loop is increment or decrement first then condition checked.In false condition also loop execute atleast once.
increment or decrement;
When number 6 is entered then condion is false because number >5 but loop execute once in false condition is also.
which show output as:-
in for loop initialization,increment or decrement,and condition all are written in single line. syntex:-
Here inc=incerement and dec=decrement.
When number 3 is entered by user then it will show output as:-
This is the concept of loops.Loops are used in programming language.I hope you will get something from it.