how check if the number is ODD or even

Other discussions about CSPro
jkajiba
Posts: 8
Joined: September 22nd, 2015, 1:40 pm

how check if the number is ODD or even

Postby jkajiba » May 15th, 2018, 9:09 am

can someone help a logic to check if a number is even or ODD

thank you

Gregory Martin
Posts: 1077
Joined: December 5th, 2011, 11:27 pm
Location: Washington, DC

Re: how check if the number is ODD or even

Postby Gregory Martin » May 15th, 2018, 12:18 pm

You can check the remainder when dividing by two:

if VALUE % 2 = 0 then
    errmsg("VALUE is EVEN");
endif;


Return to “Other”