You are on page 1of 6

LOOPING for STATEMENT

Introduction

A for loop runs provided the test expression is


true. The loop terminates execution
immediately the test expression becomes false.
This means before the execution of the loop
body in each iteration, the condition has to be
evaluated. If the evaluation returns a true, the
loop body is executed [1].
FORMAT: LOOPING for STATEMENT

for (initialization; condition; increment)


{
statement;
}
Flowchart of LOOPING for STATEMENT
Example:
Create a LOOPING for STATEMENT that will
display the following outputs:
1. 1 2 3 4 5 2. 5
4
3
3. 2
2 4 6 8 10 1
References:

[1]“C++ For Loop with EXAMPLE”. [Online]. Available:


https://www.guru99.com/cpp-for-loop.html. [Accessed: 15-Aug.-2020].

https://www.guru99.com/cpp-for-loop.html

You might also like