Another recursive method. However this time it uses the unique feature of Variable Rollover. Also, if nothing is found at the end of checking all possible values for a WORD, the outcome must be Zero.
EDIT: This may be premature, I think I left a hole at the value of "65535". StandbyCode:TestNumber as word TestVal as word For TestVal = 65534 to 2 step -2 If (TestNumber + TestVal)= 0 Then LCDOUT "Even" EndProgram Else If (TestNumber + TestVal) + 1 = 0 then LCDOUT "Odd" EndProgram Else Endif Next TestVal LCDOUT "Zero" EndProgram: end
Bookmarks