Computer Science, asked by vk6204542, 1 year ago

x = ++ y + 2y evaluates to (if y = 6)

Answers

Answered by georgejacob1307
7

Answer:

X=21

Explanation:

Given y=6

Prefix increment operator rule is change and use.

So,

++y=6+1=7

2y=7*2=14 , [because 6 has already changed to 7 in the previous part].

So,

x=7+14=21

Answered by dreamrob
1

Given,

x =  ++ y + 2y

To Find,

If y = 6  Value of x = ?

Solution,

We know that ++y means  y = y + 1 before using its value.

Its original value gets increased by 1.

New Value of y = 6 + 1 = 7

Therefore,

x = ++y +2y

x =   7 + 2*7

x = 7 + 14

x = 21

Hence, value of x  if y = 6 is 21.

Similar questions