-2

The question says 5 / 3 * 2.0 / (4 % 3) + 5 = 7.0

For some reason I don't understand why this makes sense at all. I start with dividing 5/6.0 = .83, then divide it by (4%3 which is 1) and add 5 but I'm not getting that answer. Can you explain it in detail.

Thank you.

Patrick Weiß
  • 436
  • 9
  • 23

1 Answers1

5

The rule of BODMAS/VBODMAS is what you've to remember here. Let's split it up and see how it goes.

Expression: 5 / 3 * 2.0 / (4 % 3) + 5

Step 1: 5 /3 gives 1 - Integer division
Step 2: 1 * 2.0 gives 2.0 - Multiplication
Step 3: 4 % 3 gives 1 - Modulus
Step 4: 2.0 / 1 gives 2.0 - Division
Step 5: 2.0 + 5 gives 7.0 - Addition
Rahul
  • 44,383
  • 11
  • 84
  • 103