title: Division (and negative numbers) in MIPS Assembly, how to work out remainder and print it with result?
body: <p>I am sceptical about dealing with negative numbers so positive for now, but at the moment when I enter 54 as my first integer and 8 as my second integer, I get a result of 6 rather than 6.75. How can I get both 6 to be outputted and something like Remainder equals 0.75 in my case?</p>
  <pre><code>.data
  msg1:   .asciiz &quot;\nEnter the first integer&quot;
  msg2:   .asciiz &quot;Enter the second integer&quot;
  msg3:   .asciiz &quot;Result&quot;
  
  .text
  li $v0, 4   # syscall to print string
  la $a0, msg1
  syscall
  
  li $v0, 5   # syscall to read an integer
  syscall
  add $t1, $zero, $v0
  
  li $v0, 4   # syscall to print a string
  la $a0, msg2
  syscall
  
  li $v0, 5   # syscall to read an integer
  syscall
  add $t2, $zero, $v0
  
  add $t0, $zero, $zero
  
  LOOP:
  slt $t3, $t1, $t2
  bne $t3, $zero, DONE
  sub $t1, $t1, $t2
  addi $t0, $t0, 1
  j LOOP
  
  DONE:
  li $v0, 4   # syscall to print a string
  la $a0, msg3
  syscall
  
  li $v0, 1   # syscall to print an integer
  add $a0, $t0, $zero
  syscall
  
  li $v0, 10   # syscall code to exit
  syscall
  </code></pre>
  <pre><code>'Template'
  main:
      #initialize registers
  
  loop:
      #dividend -= divsor
      #quotient++
  
      #temp = dividend - divsor
      #if temp &lt; 0 jump to done
      #jump to loop
  
  done:
      #remainder = temp
  </code></pre>