Nested If-Else Statement

#include <stdio.h>

int main() {
    // Nested if-else statement
    int score;

    printf("Enter your exam score: ");
    scanf("%d", &score);

    if (score >= 90) {
        printf("Grade: A\n");
    } else {
        if (score >= 80) {
            printf("Grade: B\n");
        } else {
            printf("Grade: C\n");
        }
    }

    return 0;
}
chevron_left
chevron_right

Leave a comment

Your email address will not be published. Required fields are marked *

Comment
Name
Email
Website