Code:If num.0=1 then oddNum = true else oddNum = false endif
GrandPa's way!
Code:OddNum = True IF Num // 2 = 0 THEN OddNum = False
Does Num = 1 work?
----------------------------
"If the Earth were a single state, Istanbul would be its capital." Napoleon Bonaparte
Page 32 of the PBP manual defines it as Remainder (Modulus). I believe Modulus or Modulo is the more generally used terminology. It's also more useful, generally, than the other methods suggested as you can use it to test whether any number is evenly divisible by any other number. See...
Last edited by dhouston; - 11th June 2008 at 13:51.
in VB
Code:If ((Text1.Text Mod 2) = 0) Then MsgBox "Even" Else MsgBox "Odd" End If
.
I think only mod formula is easy way to find oddeven.
oddeven = number mod 2
if oddeven = 0 then page is even, otherwise odd
.
How about the most rediculous, long winded, round-about way to do it?
So to sum it up so far we've got the following, verified to be working solutions.
1. AND Bitwise operator (My initial approach)
2. Direct bit checking (Melanie's approach)
3. Modulus remainder operator (Precision & Sayzer's approach)
The goal is 10 solutions -- can we do it?
Trent Jackson
Last edited by T.Jackson; - 11th June 2008 at 14:17.
Bookmarks