What is the Loops in C Language ???
Loops are Control structures that allow us to execute a block of code repeatedly based on a condition. In other Words, Loops are important control structures in the C Language that let you know continually run a piece of code based on a given conditions, They provide you to ability to handle arrays or collection of data, automate repetitive activities and execute a certain number of times.
Types of Loops in C Language
We have mainly three types of Loops in C Language which we used for Loop Control Structure,
- while Loop
- for Loop
- d-while Loop
1. while Loop
Here is the syntax of while Loop in C Language,
while (condition) {
// code block to execute while condition is true
}
2. for Loop
Here is the Syntax of the for Loop in C Language,
for (initialization; condition; increment/decrement) {
// code block to execute while condition is true
}
3. do-while Loop
Here is the syntax of the do-while Loop in C Language,
do {
// code block to execute
} while (condition);