# Fahrenheit to Celsius

.data	# Following are data
prompt: .asciiz " \n Please input degrees in fahrenheit:  "	# prompt user for input
result: .asciiz " Degrees in celsius is:  "	# display degrees in celsius
bye: .asciiz " Program 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?

Sorry, I forgot to mention that I am using MIPS architecture.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.