Answers for "nested if statement operator"

C++
0

nested conditional operator

cout << "Execute expression using "
    << "ternary operator: ";
    int a = 2 > 3 ? 2 : 3 > 4 ? 3 : 4;
    cout << a << endl;
      
    cout << "Execute expression using "
    << "if else statement: ";
    if ( 2 > 3 )
        cout << "2";
    else if ( 3 > 4 )
        cout << "3";
    else 
        cout << "4";
Posted by: Guest on March-29-2021

Code answers related to "nested if statement operator"

Browse Popular Code Answers by Language