+ 24

👉👉👉 Just a doubt ??? ☺

int x=3,y=5; System.out.print (y%x*(++x)/8) //here , it will execute like 1)5%3*4/8 // ()has highest precedence 2)2*4/8 // %,*,/ have same precedence ...executes from left to right , so here first %, then * , then / 3)8/8 // now , * comes in left ... so it executes first & then only / left //answer 1 ☺ //am i right ?????

19th Oct 2017, 6:27 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
12 Réponses
+ 13
answer is 1 // & u can believe that // i want to ask ... is my explanation right ???
19th Oct 2017, 1:36 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
that was ++x , //typing mistake 😅 //corrected now ☺
19th Oct 2017, 6:53 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 14
i see the precedence table and associativity ☺ //BODMAS not work here 😅 //u see i multiplied before division , ie , bodmas not works here
19th Oct 2017, 7:00 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
think so so ☺
19th Oct 2017, 6:38 AM
Scooby
Scooby - avatar
+ 3
ok ok then 😃
19th Oct 2017, 6:54 AM
soumya
soumya - avatar
+ 3
and my ans is 0 according to that😁
19th Oct 2017, 7:06 AM
soumya
soumya - avatar
+ 2
am not sure but when it's x++ then isn't value of x will be still 3 not 4🤔
19th Oct 2017, 6:48 AM
soumya
soumya - avatar
+ 2
that's what I was thinking according to bodmas rule
19th Oct 2017, 6:57 AM
soumya
soumya - avatar
+ 2
I mean, I can believe it.
20th Oct 2017, 11:07 AM
LunarCoffee
LunarCoffee - avatar
+ 2
I think the ans is 1
21st Oct 2017, 10:11 AM
Robin Rodrigues
Robin Rodrigues - avatar
+ 1
hi...
19th Oct 2017, 1:35 PM
中島嘉彥
中島嘉彥 - avatar
+ 1
It will be 1 according to BDMMAS .
21st Oct 2017, 11:10 AM
RZK 022
RZK 022 - avatar