Home » C++ Programming » Questions and Answers » Question
  1. What is the output of this program?
    #include 
    using namespace std;
    int max(int p, int q)
    {
    return ( p > q ? p : q);
    }
    int main()
    {
    int m = 15;
    int n = 16;
    cout << max(m, n);
    return 0;
    }
    1. Compilation Error
    2. Runtime Error
    3. Garbage value
    4. 15
    5. 16
Correct Option: E

In this program, we are returning the maximum value by using conditional operator.



Your comments will be displayed only after manual approval.