title: Program to convert temperature from F to C
body: <p>I'm writing a program to convert temperature from F to C in MIPS but the compiler returns 0. It works when I do it with integers, any ideas on what could be wrong?</p>
  
  <h2>Code Section</h2>
  
  <pre><code>    .text
  main:
  
      # Print msg
      la      $4, input_msg
      li      $2, PRINT_STR
      syscall
  
      # Prompt user for input
      li      $2, READ_INT
      syscall
  
  
  
      move     $t0, $2             #load f from memory
      sub      $t0, $t0, 32      # f -32
      mul      $t0, $t0, 5      #(f-32)*5
      div      $t0, $t0, 9       #((f-32)*5)/9  
      mtc1     $t0, $t1 
      move     $4, $t1
      li       $2, 2
      syscall
  
      li      $4, 0
      li      $2, 17
      syscall
  </code></pre>
  
  <p>The output should be the Celsius temperature in float but it returns 0.</p>