Computer Applications
What is the value of y after the execution?
y+= ++y + y-- + --y; when int y=8
Java
Java Operators
ICSE 2018
110 Likes
Answer
y = 33
Working
y+= ++y + y-- + --y
⇒ y = y + (++y + y-- + --y)
⇒ y = 8 + (9 + 9 + 7)
⇒ y = 8 + 25
⇒ y = 33
Answered By
65 Likes
Related Questions
If int y =10 then find int z = (++y * (y++ + 5));
Give the output of the following expression:
a+= a++ + ++a + --a + a--; when a = 7;Rewrite the following program segment using if-else statements instead of the ternary operator:
commission = (sale > 5000) ? sale*10/100 : 0;
Rewrite the following program segment using if-else statements instead of the ternary operator:
String grade = (marks>=90)?"A": (marks>=80)? "B": "C";