Odd or Even?

Well... To know if a number is odd or even you can do several things, for example dividing it by 2 and checking if the remaining is 0 or 1. There is a function, "MOD", which returns the remaining:

IF number% MOD 2 = 0 THEN PRINT "Even" ELSE PRINT "Odd"

You can also do a logic AND with 1:

IF (number% AND 1) = 0 THEN PRINT "Even" ELSE PRINT "Odd"

Or you can also try if integer division equals floating division:

IF number%\2 = number%/2! THEN PRINT "Even" ELSE PRINT "Odd"


OddOrEven - page last edited 2003-04-04 03:28:47 by (home) (edit)
Blast WIKI - by RoboticBoy - edited and tweaked for our evil purposes by Hexadecimal Disaster