# # Read a floating-point temperature in fahrenheit from the # user and print the answer in celsius. # # The formula is c = 5/9(5-32) # .data prompt: .asciiz "Enter temp in degrees fahrenheit: " .align 2 .text main: la $a0, prompt # print prompt syscall li $v0, 7 # read a floating point double syscall # result in $f0 li.d $f2, 32.0 # subtract 32 from $f0 sub.d $f0, $f0, $f2 li.d $f2, 5.0 # multiply $f0 by 5 mul.d $f0, $f0, $f2 li.d $f2, 9.0 # divide $f0 by 9 div.d $f0, $f0, $f2 li $v0, 3 # print the result mov.d $f12, $f0 # number being printed syscall # must be in $f12 jr $ra