Computer Science Canada what does this do? |
Author: | Genisis [ 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] |
Author: | Tony [ Mon Oct 17, 2005 9:34 am ] | ||
Post 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.
If you want decimal places, use 8 / 3 instead, but be warned that it will return a real type, not int |