0

I have to check if a number is even or odd.

My strategy:

  1. a number is even if ends with 0
  2. a number is odd if ends with 1

How do I compare the last digit of a register value to a 0 or to a 1 ?

I tried:

andi $t7, $t0, 0 # where $t0 = 3 in decimal so should be 0b11

it doesnt work :( Any hint?

piggyback
  • 9,034
  • 13
  • 51
  • 80

0 Answers0