f x is 10, what are the values of x and y after the statement below is executed? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

f x is 10, what are the values of x and y after the statement below is executed?

If x is 10, what are the values of x and y after the statement below is executed? y = ++x + x++ / 4 * (3 + x++); y = ? x = ? If x is 10, what are the values of x and y after the statement below is executed? y = x++ % 5 - --x * ++x; y = ? x = ? can you show solution i'm struggling with these pleasee :)

14th Sep 2021, 7:18 AM
Hanz Rosales
Hanz Rosales - avatar
1 Answer
+ 1
X = 10 In first: Y = ++x + x++ / 4 * (3 + x++) Y = 11 + 11(now x= 12, post increment) / 4 * (3 + 12(now x = 13, post increment)) Y = 11 + 2 * 15 = 41 X = 13, y = 41 In second: Y = x++ % 5 - --x * ++x Y = 10(now x=11, post increment) % 5 - 10 * 11 Y = 0 - 10 * 11 = -110 X = 11, y = -110
14th Sep 2021, 7:40 AM
Rupali Haldiya
Rupali Haldiya - avatar