Computer Science, asked by jas000, 9 months ago

What is the value of max in the below code snippet?

int val1 = 10;

int val2 = 20;

int max = val1 >= val2 ? val1 : val2;?

Answers

Answered by hraja8084
19

Answer:

20

Explanation:

because !(10>=20)

understood????

I very well know that this was not a difficult question for you, my friend.

Answered by adventureisland
1

The value of max is 20.

Ternary operator

  • A condition preceded by a question mark (? ), an expression to run if the conditions are true, and finally, an expression to run if the condition is false.
  • ?: is a ternary operator in programming that is part of the vocabulary for basic conditional statements in many programming languages.
  • The equation a? b: c evaluates to b if the value of an is true, and to c if it isn't.
Similar questions