What is BODMAS rules for calculation ?
Answer
Overview
BODMAS (also written as PEMDAS in the US) is the order of operations rule that defines the sequence in which mathematical operations must be performed in an expression.
BODMAS Full Form
| Letter | Operation | Example |
|---|---|---|
| B | Brackets | text |
| O | Of (Powers/Exponents) | text |
| D | Division | text |
| M | Multiplication | text |
| A | Addition | text |
| S | Subtraction | text |
Rule
Evaluate in this order: Brackets → Of → Division → Multiplication → Addition → Subtraction
Note: Division and Multiplication have equal priority (left to right). Same for Addition and Subtraction.
Examples
textBODMAS Example 1: 2 + 3 × 4 = 2 + 12 (Multiplication first) = 14 BODMAS Example 2: (2 + 3) × 4 = 5 × 4 (Brackets first) = 20 BODMAS Example 3: 10 ÷ 2 + 3 × 4 - 1 = 5 + 12 - 1 (Division and Multiplication first) = 16 (Addition and Subtraction left to right)
BODMAS in Dart
dartvoid main() { // Dart follows standard math order of operations print(2 + 3 * 4); // 14 (not 20 — multiplication first) print((2 + 3) * 4); // 20 (brackets override) print(10 / 2 + 3 * 4 - 1); // 16.0 print(10 ~/ 3); // 3 (integer division) // Order of operations in expressions double result = 5 + 3 * 2 - 8 / 4; // = 5 + 6 - 2 (mult and div first) // = 9.0 print(result); // 9.0 // Exponent using math library import 'dart:math'; print(pow(2, 3)); // 8 (2³) print(pow(3, 2)); // 9 (3²) }
Common Mistakes
text❌ Wrong: 2 + 3 × 4 = 20 (adding first) ✅ Right: 2 + 3 × 4 = 14 (multiplying first) ❌ Wrong: 20 / 5 × 2 = 2 (dividing right side first) ✅ Right: 20 / 5 × 2 = 8 (left to right: 20/5=4, then 4×2=8)
Remember: BODMAS ensures everyone gets the same answer for the same mathematical expression. Always use parentheses in code when in doubt — it makes intent explicit and avoids subtle bugs.