C Programming/Conditional statements

if...elseif...else Statement

Updated on January 8, 2026
1 min read

elseif Ladder

else–if Ladder

Explanation

The else–if ladder is used when multiple conditions need to be checked one by one. 

The first condition that evaluates to true is executed.

Syntax

if (condition1) {
}
else if (condition2) {
}
else {
}

Real life Situation:

 Student marks decide the grade.

Program

c
1
2#include <stdio.h>
3
4int main() {
5    int marks = 75;
6
7    if (marks >= 90)
8        printf("Grade A");
9    else if (marks >= 60)
10        printf("Grade B");
11    else
12        printf("Grade C");
13
14    return 0;
15}
if...elseif...else Statement | C Programming | Learn Syntax