title: How to find even odd in MIPS assembly using integer registers
body: <p>How can I find whether the input is even or odd in MIPS? I am trying to find out using integer registers, but my program is not working. Here is the code:</p>
  
  <pre><code>li $s1,2
  
  div $s0,$s1
  
  mfhi $t0
  
  xor $t1,$t0,$0
  
  beq $t1,0,Even
  
  j Odd
  </code></pre>
  
  <p>But this program shows even odd numbers as even this is because the result is in decimal like 0.3 . How can I solve this issue?</p>