Even numbers

# Thread: Even numbers

1. Senior Member
Join Date
Dec 1969
Posts
176

## Even numbers

Does anyone know the function to determine whether a number is even or not. I have a loop 1 to x and increment a counter. I need to set a flag when the counter is even, but cannot remember how to do it.<BR><BR>Thanks for any help<BR>

2. Senior Member
Join Date
Dec 1969
Posts
11,334

## RE: Even numbers

if number & 0 = 0 Then<BR>it&#039;s even<BR>else<BR>it&#039;s odd

3. Senior Member
Join Date
Dec 1969
Posts
283

## RE: Even numbers

if x mod 2 = 0 then &#039;even number

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

## RE: Even numbers

Not sure what those other things are about but;<BR><BR>Dim x &#039;=number<BR><BR>y= CInt (x/2)<BR>IF y=x THEN &#039;even number<BR><BR>Bring the value of x in from whatever you&#039;re checking.<BR>

5. Senior Member
Join Date
Dec 1969
Posts
176

## Thanks Reagan

.

6. Senior Member
Join Date
Dec 1969
Posts
176

## RE: Even numbers

Thanks to you aswell! I think Desert Ghost needs to go back to school.

7. Senior Member
Join Date
Dec 1969
Posts
11,334

## Ok, so I was wrong. Your attitude sucks

though. In other languages, that&#039;s how you do it. Can you please forgive me.<BR><BR>Least I took the effort to attempt to help you, which I won&#039;t from here on out. <BR><BR>In the future, please keep your smart *** comments to yourself.

#### Posting Permissions

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