- #1
trouty323
- 24
- 0
Code:
# Fahrenheit to Celsius
.data # following are data
prompt: .asciiz "\nPlease input degrees in fahrenheit: " # prompt user for input
result: .asciiz "\nDegrees in celsius is: " # display degrees in celsius
bye: .asciiz "\nProgram terminated" # display when program terminates
.globl main
.text # following are instructions
main: # exection begins
li $v0, 4 # system call to print string
la $a0, prompt # put prompt address into register a0
syscall
li $v0, 5 # system call to read integer
syscall
addi $t0, $v0, -32
mul $t0, $t0, 5
div $t0, $t0, 9
la $a0, result
li $v0, 4
syscall
move $a0, $t0
li $v0, 2
syscall
End:
la $a0, bye
li $v0, 4
syscall
li $v0, 10
syscall
No matter what I type in, I am getting a result of 0. Can anyone locate what I am doing wrong?