- USER CORNER
- OVERVIEW | BASICS
- C DATA TYPES
- VARIABLES IN C
- CONSTANTS or LITERALS
- C OPERATORS & ENUMS
- DECISION MAKING
- LOOPING IN C
- CONTROL FLOW IN C
- C FUNCTIONS
- ARRAYS IN C
- POINTERS IN C
The process of repeatedly executing a statements and is called as looping statement.
The statements may be executed multiple times (from zero to infinite number).
If a loop executing continuous then it is called as Infinite loop.
Looping is also called as iterations. There are three types of looping statement.
The while loop is an entry controlled loop statement. The condition is evaluated, if the condition is true then the block of statements or statement block is executed otherwise the block of statement is not executed.
The WHILE Statement is used to carry out looping operations. Hence, the loop is executed until the expression evaluates to TRUE.
The General form of this statements is :
1 2 3 4 5
In do-while loop, first attempt of loop should be executed then it check the condition.
The benefit of do-while loop/statement is that we get entry in loop and then condition will check for very first time.
In while loop, condition will check first and if condition will not satisfied then the loop will not execute any further.
Value of j variable is: 0 Value of j variable is: 1 Value of j variable is: 2 Value of j variable is: 3
|Condition is checked at the end of the loop.||Condition is checked in the beginning of the loop.|
|Set of statements within the loop will be executed atleast once.||If the condition is fals, the statements will not be executed even once.|
The for loop statement is one of the most commonly used iteration statement.
for statement is used to execute a statement or a group of statements repeatedly for a number of times.
1 2 3 4 5