Odd and Even Check
Odd and Even Check
(OP)
Does anyone know of a way to type an IF statement that checks if the input is odd or even?
Such as it outputs a 0 if it's even and a 1 if it's odd
Something like that?
THANKS!
Such as it outputs a 0 if it's even and a 1 if it's odd
Something like that?
THANKS!





RE: Odd and Even Check
Not sure if there is an easier way, but...
test = if( (-1)^n, 1, even, odd)
If n is even it sends out a 1 if it's odd it sends out a -1.
RE: Odd and Even Check
Cheers
Greg Locock
Please see FAQ731-376 for tips on how to make the best use of Eng-Tips.
RE: Odd and Even Check