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

Username:   Password: 
 RegisterRegister   
 what does this do?
Index -> Programming, Turing -> Turing Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Genisis




PostPosted: Mon Oct 17, 2005 9:03 am   Post subject: what does this do?

[/code]put "8 div 3 equals", 8 div 3[code]

i think it divids but that would have an output of 2 but then that wouldnt be right[/code]
Sponsor
Sponsor
Sponsor
sponsor
Tony




PostPosted: Mon Oct 17, 2005 9:34 am   Post subject: (No subject)

sure it's right. How many times does 3 divide into 8? Twice. There's also a remainder of 2. That's what mod gives you.
Turing:

put 8 mod 3 % = 2


If you want decimal places, use 8 / 3 instead, but be warned that it will return a real type, not int
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  [ 2 Posts ]
Jump to:   


Style:  
Search: