0% found this document useful (0 votes)
46 views9 pages

Flow of Control: By-Utkarsh Srivastava Class-XI

There are three types of flow control statements in programming: sequence, selection, and iteration. Selection statements like if-else and switch are used for conditional execution based on Boolean expressions. Iteration statements like for, while, and do-while loops allow repeated execution of code. Jump statements such as goto, break, continue, and exit() change the normal sequential flow of control.

Uploaded by

UC Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
46 views9 pages

Flow of Control: By-Utkarsh Srivastava Class-XI

There are three types of flow control statements in programming: sequence, selection, and iteration. Selection statements like if-else and switch are used for conditional execution based on Boolean expressions. Iteration statements like for, while, and do-while loops allow repeated execution of code. Jump statements such as goto, break, continue, and exit() change the normal sequential flow of control.

Uploaded by

UC Srivastava
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 9

FLOW OF CONTROL

By-Utkarsh Srivastava
Class- XI-

STATEMENTS
Null/Empty statementSyntax- ;
Use-demand by syntax but no use in logic
Compound statement(Block)Syntax- {
statement1;
statement2;
..
..
}

STATEMENTS FLOW CONTROL


Types of execution of statements in a program1.Sequence construct-Execution of statements in sequentially

2.Selection construct-Execution of statements on a condition-test

3. Iteration-repeated execution of statements on a condition-check

SELECTION/CONDITIONAL/DECISION
STATEMENTS1. If statements
Syntaxif(expression)
statement;
a) If-else statement
Syntaxif(expression)
statement1;
else
statement2;

b) The dangling elseSyntax- if(expr 1)


if(expr 2)
statement1;
else
statement2;
else
statement3;
c) The if-else-if ladderSyntax- if (expression 1) statement 1;
else
if (expression 2) statement 2;
else
if (expression 3) statement 3;

else statement 4;

THE SWITCH STATEMENT


Syntaxswitch (expression)
{
case constant1 :
statement sequence 1;
break;
case constant2:
statement sequence2;
break;
case constant3:
statement sequence3;
break;
.
.
.
case constant n-1 :statement sequence n-1;
break;
[default :
statement sequence n];

ITERATION STATEMENTS
1. For loop- entry controlled loop
Syntaxfor(initialization expression(s); test-expression; update expression(s))
body of the loop ;
2. The while loop- entry controlled loop
Syntaxwhile (expression)
loop body
3. The do-while loop- exit controlled loop
Syntaxdo {
statement ;
}
while (test-expression) ;

JUMP STATEMENTS
1.

The goto statement

Syntax-

goto label;

.
.
.
label :
2.

The break Statement

3. The continue statement

4. The exit() function- Breaks out of a program

You might also like