If int y=14 then find z=(++y*((y++ )+5).
Answers
Answered by
4
Answer:
hello
Explanation:
z=++y*(y++ +5)
=11*(11 +5)
=11*16
=176.
Answered by
23
Answer:
300
Language using: Java
Explanation : Theoritically, by hand :
Given, y=14 and the statement is z=(++y*((y++ )+5)
So, ++y*((y++ ) + 5) will be evaluated as follows. (Left to right)
++y = pre increment; 14+1 = 15
now, y=15
and then, y++ = post increment; 15 and then increments, which isn't necessary to take into consideration now.
So, the final statement evaluated will be z=15*(15+5) = 15*20 = 300
Program:
public class something
{
public static void main(String []args)
{
int y = 14;
int z = ++y*(y++ + 5);
System.out.println(z);
}
}
Output:
300
Note:
Please do check the attachment given below to see the compilation details.
Cheers!!!
Attachments:
Similar questions