+ 1
I aspect "0" as output in this code. Based on "BODMAS" .But I get "2" as output why?
3 odpowiedzi
+ 4
Yogeshwaran
According to bodmas ... content inside brackets work first
If you change the code as
3*(4/5)-->. You get 0 as output...
+ 4
3 * 4 = 12
12 / 5 = 2.4
so you cast to int that means remove everything after the '.'
and the result is 2
+ 2
I hear 1st time about the BODMAS, But i think you need to see the colors and not the letters.
https://images.app.goo.gl/vwSM3RyoxVTNoX8j9
multiply and division has exactly same priority, so you do 1st what is the most left