---
title: "2.4 else-if Ladder"
description: "An `else-if` ladder evaluates multiple conditions in sequence. The first condition that evaluates to a non-zero value determines which block is executed. ``` #include int main() { int marks = 72; if (marks >= 90) { printf(\"Grade A+\\n\"); } else…"
url: "https://edcret.in/docs/c-programming/control-flow/2-4-else-if-ladder/"
updated: "2026-09-06"
category: C Programming / Control Flow
---

# 2.4 else-if Ladder

An `else-if` ladder evaluates multiple conditions in sequence. The first condition that evaluates to a non-zero value determines which block is executed.

```
#include <stdio.h>

int main()
{
    int marks = 72;

    if (marks >= 90)
    {
        printf("Grade A+\n");
    }
    else if (marks >= 75)
    {
        printf("Grade A\n");
    }
    else if (marks >= 60)
    {
        printf("Grade B\n");
    }
    else if (marks >= 40)
    {
        printf("Grade C\n");
    }
    else
    {
        printf("Grade F\n");
    }

    return 0;
}
```

### Example Output

```
Grade B
```

### Explanation

The first condition checks whether `marks` is at least `90`. Since `72` is less than `90`, that block is skipped.

The next condition is evaluated:

```
else if (marks >= 75)
```

This is also false, so execution continues to the next `else if`:

```
else if (marks >= 60)
```

This condition is true because `72` is greater than or equal to `60`. Its block executes and prints `Grade B`.

Once a condition in the ladder evaluates to non-zero, the remaining conditions are not evaluated.

The final `else` executes only when none of the preceding conditions is true.
