C++ Cascade if else statement

C++ Cascade if else statement

June 22, 2024·İbrahim Korucuoğlu
İbrahim Korucuoğlu

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\n";
    } else if (a == 20) {
        cout << "a is equal to 20\n";
    } else {
        cout << "a is greater than 20\n";
    }
    return 0;
}
Last updated on