♦ C For Loop
♣ About C For Loop
For Loop iterates over certain conditions.Below is the representation of For Loop Syntax.
Basic Syntax
for (initializationStatement; Expression; updateStatement) { // statements inside the body of loop }
Syntax Explanation:
initializationStatement: The variable initialization Expression: Limit for iteration in terms of variable value updateStatement: increment function in terms of variable
♣ Example1: Number Loop in C
In this example, there is a Loop Iterating till 5. Example
Input:
Output:
♣ Example2: Iterate Through String in C
In this example, program will Iterate through a string to print characters. Example
Input:
Output: