Log in

View Full Version : Even and odd


saworms
16-10-2010, 12:22
It is my first day in labview and I need to determine if a number is even or odd.
Can someone please tell me how to do it.

Spencer

DonRotolo
16-10-2010, 12:49
Divide by 2, then compare the integer result to the floating point result. If they are equal, it's even.

Joe Ross
16-10-2010, 12:55
Are you having trouble figuring out how to determine if a number is even, or how to implement the algorithm in LabVIEW. Perhaps you could ask more specific problems.

Greg McKaskle
16-10-2010, 15:09
To keep it integer, use the remainder and quotient block. It is similar to the mod() operation in some other languages. If N div 2 has a remainder of 0, it was even.

Greg McKaskle