60 likes | 138 Views
Learn about mathematical operators in programming, including addition, subtraction, multiplication, division, exponentiation, and modulus calculation. Explore integer division and how modulus helps find remainders. Practice with examples to solidify understanding.
E N D
What Operators Do We Know? + • Adding • Subtracting • Multiplying • Dividing • Power (or Exponent) - * / ^
What Operators Are We Learning About Today? • \ which means Integer Division • mod which means Modulus (or remainder) Integer Divisiontruncates the decimal portion of the quotient. 13 \ 5 = Modulus Division returns the remainder resulting from the division. 13 mod 5 =
Integer Division Examples: 3 23 \ 7 = 9 \ 4 = 20 \ 3 = 64 \ 5 = 57 \ 11 = 46 \ 2 = 38 \ 9 = 2 6 12 5 23 4
Mod Examples 1 • 17 mod 2 = • 27 mod 2 = • 47 mod 8 = • 45 mod 3 = • 46 mod 6 = • 77 mod 11 = • 53 mod 4 = • What can “mod” tell you about? 1 7 0 4 0 1
Program Assignment: Skyhook Application page 4-10 Review 6