Order of operations, also called operator precedence, is a set of rules specifying which procedures should be performed first in a mathematical expression.
For example, in the expression “five added to six multiplied by seven,” the operators are addition and multiplication (five, six, and seven are the operands). If the addition is performed first, the result is 77, but if multiplication is performed first, the result is 47. Order of operations dictates that the correct answer is 47 because multiplication and division must always be performed before addition and subtraction.
Mathematical order of operations
- Parentheses, exponents, and roots.
- Multiplication and division.
- Addition and subtraction.
Computer programing
In computer programming, most languages use precedence levels that are the same as science and mathematics. Some languages, such as Smalltalk and Lisp, have no precedence rules at all; the programmer must specify the operators in the correct order.
An easy way to remember the order of operations is PEMDAS, or “Please Excuse My Dear Aunt Sally.”
In the C programming language, the following levels of operator precedence apply, listed here in order of decreasing precedence:
Operator, Procedure, Programming, Programming terms