C++ Cascade if else statement

You can see the usage of cascade if-else statement example below.

You can see the usage of cascade if-else statement example below.

#include <iostream>

using namespace std;

int main() {
/* cascade if else statement */
    int a;
    cout << "Enter a positive integer number: ";
    cin >> a;
    if (a < 20) {
        cout << "a is less than 20 ";
    } else if (a == 20) {
        cout << "a is equal to 20 ";
    } else {
        cout << "a is greater than 20 ";
    }
    return 0;
}
Last modified 17.01.2025: new translations (f32b526)