0
Whats the logic here.
suppose i have two integers int a = 2; int b = 7; case 1: System.out.print(a + b / a); case 2: System.out.print( 9 / 2); case one gives me "5" while 2 gives me "4". kindly explain.
2 odpowiedzi
+ 2
Similar to maths, programming languages also uses BODMAS.
In case 1, first 7 is being divided by 2 (equals to 3.5) and then 2 is being added (equals to 5.5)
In case 2, it divides 9 by 2(equals 4.5)
0
okay i get it now