Use the else keyword with if statement - C++ Statement

C++ examples for Statement:if

Description

Use the else keyword with if statement

Demo Code

#include <iostream>

using namespace std;

int main(){/*from  w ww .  java2  s  .c  o m*/
    int i;

    cout << "Type any number: ";
    cin >> i;

    if (i > 10)
    {
        cout << "It's greater than 10." << endl;
    }
    else
    {
        cout << "It's not greater than 10." << endl;
    }

    return 0;
}

Result


Related Tutorials