Computer Science, asked by roytapashwbp50, 7 months ago

int x=5, y=4, z;
z=x*y++ + ++x/y;
System.out.println (z);
Java. Explain​

Answers

Answered by vedantb2960
6

Hi here is the answer...

Answer-

So first they are declaring and initializing the variables x=5,y=4,z

now assigning z the value-

(x*y++) + (++x/y)

y++ means incrementing y by 1

so x*y++ = 5*5=25

now ++x also means incrementing x by 1

so ++x/y = 6/4 = 1.5

finally add them both because of the plus sign between the 2 expressions

25+1.5=26.5

z is assigned value of 26.5, and then printing it to the console by the line 'System.out.println (z);'

hope it helps....

Similar questions