IF – ELSE STATEMENT IN C WITH EXAMPLE
The if – else statement is an extension of the simple if statement.
Syntax:-
if(condition)
{
True - Block of Statement
}
else
{
False - Block of Statement
}
Statement;
Note:-
# Condition can be expression or relation.
# If body of statement is only one statement than braces ({}) are not needed.
# Body of the statement may have one or more statement.
# Either true – block of statement or false – block of statement is executed, not both.
Execution:-
If condition is true than true - block of statement is executed otherwise false - block statement is executed than control is moved to statement next to if statement.
Examples:-
Program to find even number
Program to find greatest number between 2.
http://genuineptr.com/pages/index.php?refid=asangidevaraj
0 comments:
Post a Comment