Can anyone guess the output for this code | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can anyone guess the output for this code

int x=4; int y; y=++×*4/x+x; System.out.print(y+x);

21st Jun 2017, 4:00 AM
Teja Sree
Teja Sree - avatar
9 Answers
+ 19
Error.. uve used × instead of x
21st Jun 2017, 4:01 AM
Frost
Frost - avatar
+ 18
@S Vengat you forgot +x in denominator... /x+x
21st Jun 2017, 4:16 AM
Frost
Frost - avatar
+ 8
Is it actually y = 5*4/4+4 or y = 5*4/5+5 Nobody knows.
21st Jun 2017, 4:12 AM
Hatsy Rei
Hatsy Rei - avatar
+ 8
🍪🔫
21st Jun 2017, 4:19 AM
Hatsy Rei
Hatsy Rei - avatar
+ 6
y = ++4 * 4 / x + x y = 5 * 4 / 5 + 5 y = 4 + 5 y = 9 x + y = 5 + 9 = 14. Output: 14 @Frost Dang haha, I didn't catch that.
21st Jun 2017, 4:04 AM
Rrestoring faith
Rrestoring faith - avatar
+ 6
9 by PEMDAS I suppose (4+1)*4/4, then the result 5 5+4=9 Amirite?
21st Jun 2017, 4:14 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 4
System.out.println( 🍪 > 🔫); 🍼 Output: True
21st Jun 2017, 4:26 AM
Rrestoring faith
Rrestoring faith - avatar
+ 3
@Hasty Another fail by me, yea it should be 5 * 4 / 5 + 5; Since this gives 2: int x = 0; System.out.println(++x + x); Spooky 😶 (I'll just edit my original post like nothing happened. Idk what yall talking about, focus on your cookies.)
21st Jun 2017, 4:14 AM
Rrestoring faith
Rrestoring faith - avatar
+ 2
but given key is 14
21st Jun 2017, 4:02 AM
Teja Sree
Teja Sree - avatar