0
This is our assignment in Php, f(5) = 1+2*3+4*5
if odd multiply number, if even sum. result of the question is 65
1 ответ
+ 1
The order of operations in which one is to interpret a mathematical expression such as "2+3 * 5" is a convention. This means that a long time ago, people just decided on an order in which operations should be performed. It has nothing to do with magic or logic. Some people decided to adopt a way, and it has stuck ever since. It just makes communication a lot easier.
Another way of saying this is that rather than being inherent in the structure of mathematics, the concept of "order of operations" is a matter of mathematical notation. Order of operations refers to which operations should be performed in what order, but it's just convention. The notation tells you which operations to do first, not something about the underlying mathematics.
To remember the conventional order of operations, you can think of
PEMDAS
(You might remember this as "Please excuse my dear Aunt Sally.")1
Parentheses
Exponents
Multiplication and Division
Addition and Subtraction
This means that you should do what is possible within parentheses first, then exponents, then multiplication and division (from left to right), and then addition and subtraction (from left to right). If parentheses are enclosed within other parentheses, work from the inside out.
1Some people are taught to remember BEDMAS:
Brackets
Exponents
Division and Multiplication, left to right
Addition and Subtraction, left to right
Here are two examples:
3 + 5 x 7 = ?
3 + 5 x 7 = 3 + 35 = 38
(1 + 3) x (8 - 4) = ?
(1 + 3) x (8 - 4) = 4 x 4 = 16