Display even(odd) number only
Mohamed Refky
Posts: 47
Hello,
How to determine that a number is odd number or even number?
Thank You
How to determine that a number is odd number or even number?
Thank You
Comments
'number is odd
ELSE
'number is even
ENDIF
you can also do it by testing bit 0 of the value, it its a 0 its even if its a 1 its odd, this method is actually·quicker than using modulo in the first method.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10
· IF (myValue.BIT0 = 1) THEN
··· ' number is odd
· ELSE
··· ' number is even
· ENDIF
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Jon Williams
Applications Engineer, Parallax
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
·1+1=10