Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Difference Between Mod and Rem
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
GlobeTrotter




PostPosted: 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
Sponsor
sponsor
person




PostPosted: Wed Mar 30, 2005 6:30 pm   Post subject: (No subject)

try negatives
jamonathin




PostPosted: 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 Confused
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




PostPosted: Wed Mar 30, 2005 6:38 pm   Post subject: (No subject)

Thanks
jamonathin




PostPosted: Wed Mar 30, 2005 6:39 pm   Post subject: (No subject)

wow that was a fast respond... Exclamation
Display posts from previous:   
   Index -> Programming, Turing -> Turing Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 5 Posts ]
Jump to:   


Style:  
Search: