what is arithmetic operators?

Arithmetic operators are the symbols that represent arithmetic math operations. Examples include + (addition operator), – (subtraction operator), * (multiplication operator), and / (division operator).

arithmetic operator

1.%,/,*

2.+,-

there are five arithmetic  operators in C language.

  1. multiplication(*).
  2. divide (/) .
  3. modules(%).
  4. addiction(+).
  5. subtraction(-).

*,%   and / are having same priority but higher than – and +.

+ and – having some priority.

for example have following expression.

x=3+4*5/2-7.

first we solve astrick because it has higher priority than (+) and (_).

whenever two or more arithmetic operators of the same priority comes in the expression.

whenever two or more arithmetic operators of the same priority comes in the expression then we have to resolve them in left to right manner.

like above example astrick comes in the left in comparision to (/) operators it will be solve first.

note:–associative rule is left to right for arithmetic operator.which means equal priority

will be resolved in left to right manner.

x=30+20/2-7

=3+10-7

=13-7

=6.

Leave a Reply

Your email address will not be published. Required fields are marked *