C++ if else statement

In this article, you can examine the use of C++ if else statement.

In this article, you can examine the use of C++ if else statement.

#include <iostream>

using namespace std;

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