Figuring out if a variable is an odd or even numbe

# Thread: Figuring out if a variable is an odd or even numbe

1. Brian Yager Guest

## Figuring out if a variable is an odd or even numbe

Hello all. Sorry if this is a basic queston, but I need to know how to figure out if a variable is an even or odd number. Can someone show me the code or function?<BR>Thanks,<BR><BR>Brian

2. Senior Member
Join Date
Dec 1969
Posts
1,432

## divide ....

the nuber by 2 and check if there is a decimal.

3. Dan
Senior Member
Join Date
Dec 1969
Posts
1,364

## RE: divide ....

use the MOD function:<BR><BR>x= your# MOD 2<BR><BR>x= the remainder of your#/2 if it is 0 then it is an even #

4. Senior Member
Join Date
Dec 1969
Posts
1,912

## RE: Figuring out if a variable is an odd or even n

&nbsp;<BR>dim i<BR>dim output<BR>output = "even"<BR>For i = 0 to number do<BR>if output = "even" then<BR>output = "odd"<BR>else<BR>output = "even"<BR>end if<BR>next i<BR>

5. Brian Yager Guest

## RE: divide ....

Thanks...This worked...I appreciate all the help!

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•