-
What is the output of this program?
#include <iostream>
using namespace std;
int main ()
{
int p, q, R;
p = 5;
q = 3;
R = (p > q) ? p : q;
cout << R;
return 0;
}
-
- 3
- Compilation Error
- Runtime Error
- Garbage value
- 5
Correct Option: E
We are using the ternary operator to evaluate this expression. It will return first option, if first condition is true otherwise it will return second