Computer Science, asked by Pramodtudu99, 7 months ago

What will be the output of the following, if x =10 initially? (x++ > 10 ? 20 :30 )

Answers

Answered by rohitkhajuria90
0

OUTPUT is 30

In the given statement

(x++ > 10 ? 20 :30 )

x++, value of x will be 10, if x is used again then it will be 11

For now it is 10

Hence,

10>10 is false

So the output is 30

FYI...

(x++ > 10 ? 20 :30 )

Before ? symbol : expressions is condition (x++>10)

After? symbol : expressions are results 20:30

Here, 20 is given as output if condition is true

30 is given as output if condition is false

Similar questions