How to write a program to find the lowest ODD integer in a string of digits entered by the user?
For example: I type 27385
, so 3 is the lowest odd integer.
How to write a program to find the lowest ODD integer in 68000 assembly?
378 views Asked by user3079845 At
1
You can take adavtange of the fact that in binary a number is odd, when the lowest bit is set, otherwise it is even. Since the ASCII value of a digit is almost the direct representation of the number itself, you can use it as is, or subtract 0x30 to get the binary number from the digit char you are looking at.
Pseudocode (loop through the string):