30 likes | 191 Vues
Integer Arithmetic. Mod and . Two of the more unusual arithmetic operators are Mod and Excel and VBA let you use them on Doubles as well, but we will stick to integers
E N D
Mod and \ • Two of the more unusual arithmetic operators are Mod and \ • Excel and VBA let you use them on Doubles as well, but we will stick to integers • The \ operator is integer divide. It gives you the whole part of the answer without a remainder when two integers are divided • Mod gives the remainder
Examples • 17 \ 3 = 5 (the integer part of the quotient) • 17 Mod 3 = 2 (the remainder) • 24 \ 5 = 4, while 25 \ 5 = 5 • 24 Mod 5 = 4, while 25 Mod 5 = 0 • You can see these in action in the spreadsheet called CoinsIntegerDemo • This sheet also illustrates using a piece of clipart for a button