Applying Operators
Justin Aufderheide
Different Types of Division
Basic Math Operators
- + (add) Ex: 4+3=7
- - (subtract) Ex: 5-2=3
- / (divide) Ex: 9/3=3
- * (multiply) Ex: 3*4=12
- ^ (exponents) Ex: 2^3=8
Regular Division
Regular division is simply dividing. Keep the whole number and decimal. It is the one that you grew up with your whole life.
Integer Division
Integer division is a little different. You still divide, but only keep the whole number and not the decimal or fraction, if there is any left over. Represented by \ in an equation. An example would be "72 \ 7 = 10" the extra 2 is not kept because it is integer division.
Modular Division
Modular division is basically the opposite of integer division. You divide, and then only keep what is left over. If the result is a whole number, than the answer would be zero. Represented by "Mod" in an equation. An example would be " 33 mod 4 = 1" because 4 *8 is 32, and there is one left over, so that would be the answer.
Operators of Operations
Just like in math, in programming math follows the same rules. First you do what is in Parenthesis, then the Exponents, then Multiplication and Division, and finally Addition and Subtraction. It can be easily remembered using Please Excuse My Dear Aunt Sally (PEMDAS).