Control
Statements
SHUBHANSHU & AYUSH
What are Control statements are used in a
programming language to control the flow
of the program. They are nothing but a
control keyword or statements that are used in a
program to transfer the flow of control to
statements? another statement based on the
conditions.
There are various types of control
flow statements
01 DECISION MAKING STATEMENTS:
If Statements. Types
Switch Statements.
of
02 LOOP STATEMENTS:
For loop. Control
While loop.
Do while loop. Statements.
THERE ARE VARIOUS TYPES OF IF STATEMENTS
01 IF STATEMENT
Types 02 IF/ELSE STATEMENT
of
If Statements. 03 NESTED IF STATEMENT
04 IF/ELSE-IF LADDER
Simple If Statement
It is the most basic statement among all control flow
statements in C++.
It evaluates a Boolean expression and enables the
program to enter a block of code if the expression
evaluates to true.
Simple If Statement
If
If/Else Statement
The if-else statement also tests the condition.
It executes when if condition is true otherwise
else block is executed.
If/Else Statement
If
Else
Nested If Statement
The nested if statement represents the if block
within another if block. Here, the inner if block
condition executes only when outer if block
condition is true.
Nested If Statement
te s
Ne
d
If
If-Else-If Ladder
The if-else-if ladder statement executes one
condition from multiple statements.
If
If/Else-If Ladder
se
El f
I
Switch Statement
The switch statement executes one statement
from multiple conditions. It is like if-else-if ladder
statement in C++.
Switch Statement
h
itc
Sw
THERE ARE VARIOUS TYPES OF LOOPS
Types 01 FOR LOOP
of 02 WHILE LOOP
Loops. 03 DO WHILE LOOP
For Loop
The for loop is used to repeat a part of the program several
times. If the number of repetition is fixed, it is recommended to
use for loop.
For Loop
r
Fo
While Loop
The while loop is considered as a repeating if statement. If
the number of repetition is not fixed, it is recommended
to use the while loop.
While Loop
li e
h
W
Do-While Loop
The do-while loop is used to perform a part of the program
several times. If the number of repetition is not fixed and you
must have to execute the loop at least once, it is
recommended to use do-while loop.
Do-While Loop
Do
hile
W
Thank
you!!