C Programming - Control Instructions - Discussion

Discussion Forum : Control Instructions - General Questions (Q.No. 4)
4.
In mathematics and computer programming, which is the correct order of mathematical operators ?
Addition, Subtraction, Multiplication, Division
Division, Multiplication, Addition, Subtraction
Multiplication, Addition, Division, Subtraction
Addition, Division, Modulus, Subtraction
Answer: Option
Explanation:

Simply called as BODMAS (Brackets, Order, Division, Multiplication, Addition and Subtraction).

Mnemonics are often used to help students remember the rules, but the rules taught by the use of acronyms can be misleading. In the United States the acronym PEMDAS is common. It stands for Parentheses, Exponents, Multiplication, Division, Addition, Subtraction. In other English speaking countries, Parentheses may be called Brackets, or symbols of inclusion and Exponentiation may be called either Indices, Powers or Orders, and since multiplication and division are of equal precedence, M and D are often interchanged, leading to such acronyms as BEDMAS, BIDMAS, BODMAS, BERDMAS, PERDMAS, and BPODMAS.

For more info: http://en.wikipedia.org/wiki/Order_of_operations

Discussion:
4 comments Page 1 of 1.

Amitabha Das said:   7 years ago
No, Question cannot be like that because division and multiplication have save priority and addition and subtraction have equal priority. Its only that they are left to right associative. If multiplication is to the left of division, multiplication will be executed 1st because its left associative.

Mohit Anand said:   4 years ago
@All.


I think that, this question is not fully correct.

As we take about priority then:-
1st priority to !
2nd to *,\,%
3rd to +,-
4th to <>,<=,>=
5th to ==, !=
6th to &&
7th to ||
8th to =.

Correct me if I am wrong.

Nizamuddin said:   1 decade ago
In presidency table * / % is no. 3 and associativity is left to right + - is no. 4 associativity is 4 so first salve 3 then 4 .

Right ans is (B): Division, Multiplication, Addition, Subtraction.

Drink said:   1 decade ago
Hmm, but why Division before Multiplication if it's left-to-right associativity? Or maybe it doesn't matter if Division or Multiplication comes first?

Post your comments here:

Your comments will be displayed after verification.