answersLogoWhite

0

The basic rules of arithmetic and algebra apply in most cases. That is:

Exponentiation is done first

Multiplication and division are done next

Finally, addition and subtraction are done.

If two or more operations with the same priority appear together in the same expression, they're handled in left to right order. Parentheses can be used to override the order of operations; expressions in parens are evaluated first.

For example, 2*4**2 - 8/4 would be evaluated this way:

Do the exponent first: 4**2 = 16. The expression is then 2*16 - 8/4

Next do the multiplication and division: 2*16 = 32 and 8/4 = 2

Do the subtraction last: 32 - 2, or 30.

The only possible difference is in division, IF you're using computer rules for integer operations. Because a fully integer-based expression can only be expressed as another integer, computers perform integer division by truncating any fractional remainder of a quotient. So for example a computer would evaluate 7 / 2 = 3, rather than 3.5. If the numbers were expressed as real numbers the answer would be correct in the algebraic sense, though: 7. / 2. = 3.5

User Avatar

Wiki User

16y ago

Still curious? Ask our experts.

Chat with our AI personalities

FranFran
I've made my fair share of mistakes, and if I can help you avoid a few, I'd sure like to try.
Chat with Fran
ViviVivi
Your ride-or-die bestie who's seen you through every high and low.
Chat with Vivi
RossRoss
Every question is just a happy little opportunity.
Chat with Ross

Add your answer:

Earn +20 pts
Q: What are the rules for operations with integers?
Write your answer...
Submit
Still have questions?
magnify glass
imp