C++ Control Flow Statements

Decision Making and Branching/ control flow statements

if condition

(i)
if (condition)
Statement A;

If the given condition is true then statement A will get executed.

(ii)

if(condition)
statement A;
else
statement B;

If the given condition is true then statement A will get executed otherwise statement B will get executed.

Note:
if there is only one statement associated with the condition we may or may not use { }

(iii)

if(condition)
{
Statements A;
Statements A;
}

If the given condition is true then statements A will get executed.

Note:
if there are number of statements associated with the condition we have to use { }

Number Of Visitors

0125659