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.



Previous Code:-
if decision making statement

List Code:-
C Codes

Next Code:-
Nesting of if statement

C Programs
List of c Programs

Leave reply

Add your comments here

Back to Top