C Programming - Expressions - Discussion

Discussion Forum : Expressions - General Questions (Q.No. 2)
2.
Which of the following correctly shows the hierarchy of arithmetic operations in C?
/ + * -
* - / +
+ - / *
/ * + -
Answer: Option
Explanation:

Simply called as BODMAS (Bracket of Division, Multiplication, Addition and Subtraction).

How Do I Remember ? BODMAS !

  • B - Brackets first
  • O - Orders (ie Powers and Square Roots, etc.)
  • DM - Division and Multiplication (left-to-right)
  • AS - Addition and Subtraction (left-to-right)
  • Discussion:
    13 comments Page 2 of 2.

    Vikas said:   1 decade ago
    The given answer is incorrect the priority is:

    highest- *
    /
    %
    +
    -

    i.e. multiplication has higher priority than division.

    Kapil said:   1 decade ago
    And what about % mod?

    Kiran said:   1 decade ago
    Do you give more information about BODMAS. ?.

    I want to know all hierarichies.


    Post your comments here:

    Your comments will be displayed after verification.