var x = 8 ,, y = x++ * 5, z = (y % x); alert (z) // z = 0 or 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

var x = 8 ,, y = x++ * 5, z = (y % x); alert (z) // z = 0 or 4

What's the out put https://code.sololearn.com/W01eHy160Pct/?ref=app

18th Jun 2020, 9:37 AM
cabdiqani Ahmed
cabdiqani Ahmed - avatar
2 Answers
+ 2
var x = 8 var y = x++ * 5 // 40, after this line x is 9 var z = (y % x) // 40 % 9 alert (z) // 4 because it is the remainder.
18th Jun 2020, 9:39 AM
Avinesh
Avinesh - avatar
+ 1
Output is 4 as y = x++ * 5 == 8 * 5 == 40 Because x++ will return x and then after will add 1 to it. z = y % x == 40 % 9 == 4 Because now x is 9! So z = 4
18th Jun 2020, 9:41 AM
Hacker Badshah
Hacker Badshah - avatar