Difference Between Mod and Rem
Author |
Message |
GlobeTrotter
|
Posted: Wed Mar 30, 2005 6:22 pm Post subject: Difference Between Mod and Rem |
|
|
Don't they both give the remainder? For example, using the example that comes w/ turing, changing the mod and rem doesn't effect the program. |
|
|
|
|
|
Sponsor Sponsor
|
|
|
person
|
Posted: Wed Mar 30, 2005 6:30 pm Post subject: (No subject) |
|
|
try negatives |
|
|
|
|
|
jamonathin
|
Posted: Wed Mar 30, 2005 6:35 pm Post subject: (No subject) |
|
|
This example if from the turing help file (edited a bit), and when the number is positive, they both do the same, but when the number is negative, mod tells you how many you need to get the other number, and rem tell you how much you are over the last time you matched that other number. Buttt, i could be wrong
code: |
var eggCount : int
get eggCount
put "You have ", eggCount div 12, " dozen eggs"
put "You have ", eggCount mod 12, " left over - mod"
put "You have ", eggCount rem 12, " left over - rem"
|
|
|
|
|
|
|
GlobeTrotter
|
Posted: Wed Mar 30, 2005 6:38 pm Post subject: (No subject) |
|
|
Thanks |
|
|
|
|
|
jamonathin
|
Posted: Wed Mar 30, 2005 6:39 pm Post subject: (No subject) |
|
|
wow that was a fast respond... |
|
|
|
|
|
|
|