Computer Science, asked by Keshavshahi, 4 months ago

If int x=15;y=20 ;what will be the value of x after executing the following statement
x=(x<y)?(y+x):(y-x);​

Answers

Answered by ArpitMishra506
2

Answer : x = 35

Explanation :

The condition (x<y) is true because x i.e. 15 is smaller than y i.e. 20.

So, the first statement will be executed i.e. (y+x)

so value of x = (y+x) = (20+15) = 35

.

.

.

.

HOPE THIS HELPS YOU

.

.

.

.

PLEASE MARK AS BRAINLIEST AND FOLLOW ME TOO

Answered by anindyaadhikari13
1

Question:-

  • Write the output of the following code.

Steps:-

int x=15,y=20;

x=(x<y)?(y+x):(y-x);

Here, x<y is true since 15<20 is true.

So, true part will execute.

So,

x=y+x

Or,

x=15+20

Or,

x=35

Output:-

35

Similar questions