Sail E0 Webinar
Question


What is the output of this program?


1.
#include
2.
using namespace std;
3.
int max(int a, int b )
4.
{
5.
return ( a > b ? a : b );
6.
}
7.
int main()
8.
{
9.
int i = 5;
10.
int j = 7;
11.
cout
Options:
A .  5
B .  7
C .  either a or b
D .  none of the mentioned
Answer: Option B

In this program, we are returning the maximum value by using conditional operator.
Output:
$ g++ ret.cpp
$ a.out
7



Was this answer helpful ?
Next Question

Submit Solution

Your email address will not be published. Required fields are marked *

Latest Videos

Latest Test Papers