Question
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
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
Answer: Option B
Was this answer helpful ?
In this program, we are returning the maximum value by using conditional operator.
Output:
$ g++ ret.cpp
$ a.out
7
Was this answer helpful ?
Submit Solution