Branching:
If refers to execute one of several possible options depending on the outcome of a logic, which is carried at some specific point within a c program.
:Example:
Nested if-else statement
if – else statement with in other if – else statement. Such statements are called nested if statements in c programming language.
if (expression1)
If refers to execute one of several possible options depending on the outcome of a logic, which is carried at some specific point within a c program.
:Example:
Nested if-else statement
if – else statement with in other if – else statement. Such statements are called nested if statements in c programming language.
if (expression1)
{
Execute if expression1 is true;
}
Execute if expression1 is true;
}
else if( expression2)
{
Execute if expression1 is false and 2 is true;
}
else if (expression 3)
Execute if expression1 is false and 2 is true;
}
else if (expression 3)
{
Execute if text expression1 and 2 are false and 3 is true;
}
Else
{
Execute if all of the expressions are false;
}
Execute if text expression1 and 2 are false and 3 is true;
}
Else
{
Execute if all of the expressions are false;
}
exemple can be like this:
Tidak ada komentar:
Posting Komentar