Saturday 21 September 2013

Arithmetic Operators in Programming Languages

Here we are trying to give basic information like programming for beginners, programming basics and to learn programming.

In C language we have the usual arithmetic operators for addition, subtraction, multiplication and division. C also provides a special arithmetic operator which is called modulus. All these operators are binary operators which means they operate on two operands. So we need two values for addition, subtraction, multiplication, division and modulus.
Operators
Operations
Precedence (Order of Evaluation)
()
Parentheses
Evaluated first
*, /, or %
Multiplication, Division, Modulus
Evaluated second. If there are several, they are evaluated from left to right.
+ or -
Addition, Subtraction
Evaluated last. If there are several, they are evaluated from left to right.


For example if we want to evaluate the expression like 7*6+6/3 what will be the result? The result of this expression will be 44 as we will evaluate first 7*6 = 42 and then 6/3= 2 then we will add these values we will get 42+2 = 44. There are many programming tips and tricks to follow.

No comments:

Post a Comment