The basic operators for performing arithmetic operations are the same in many computer languages. The various arithmetic operators used for arithmetic operations are as follows:
- Addition Operation
‘+’ operator is used to add two numbers as a+b - Subtraction Operation
‘-‘ operator is used to subtract two numbers (as in a-b) - Multiplication Operation
‘*’ is the Multiplication operator used to multiply two numbers (as in a*b) - Division Operation
‘/’ is the division operator. When applied to integers, it discards any remainder. - Modulus (remainder) Operation
‘%’ is the modulus operator that gives the remainder when two integers are divided. The modulus operator can only be applied to integers
GET INSTANT HELP FROM EXPERTS!
- Looking for any kind of help on your academic work (essay, assignment, project)?
- Want us to review, proofread or tidy up your work?
- Want a helping hand so that you can focus on the more important tasks?
Hire us as project guide/assistant. Contact us for more information
Precedence
The term ‘precedence’ refers to how “tightly” operators bind to their operands (that is, to the things they operate on). Multiplication, division, and modulus all have higher precedence than addition and subtraction. In mathematics, multiplication has higher precedence than addition, so 1+2*3 is 7, not 9. In other words, 1+2*3 is equivalent to 1+(2*3).
Associativity
All of these operators ‘group’ from left to right, which means that when two or more of them have the same precedence and participate next to each other in an expression, the evaluation conceptually proceeds from left to right.
For example, 1-2-3 is equivalent to (1-2)-3 and gives -4, not +2.
StudyMumbai.com is an educational resource for students, parents, and teachers, with special focus on Mumbai. Our staff includes educators with several years of experience. Our mission is to simplify learning and to provide free education. Read more about us.
Leave a Reply
You must be logged in to post a comment.