C++ if else statement

C++ if else statement

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

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\n";
    } else {
        cout << "a is not less than 20\n";
    }
    return 0;
}
Last updated on