So I am trying to find the greatest common denominator between 3 numbers. I think that my logic is pretty sound on how to do this and I am currently not getting the correct output.
li $s0, 1
whileloop:
bgt $s0, $t0, exit
bgt $s0, $t1, exit
bgt $s0, $t2, exit
IF1:
div $s0, $t0
mfhi $s1
bne $s1, $zero, else
IF2:
div $s0, $t1
mfhi $s2
bne $s2, $zero, else
IF3:
div $s0, $t2
mfhi $s3
bne $s3, $zero, else
sw $s0, 4($s4)
j else
else:
addi $s0, $s0, 1
j whileloop
exit:
la $a0, answer
syscall
move $a0, $s4
li $v0, 1
syscall
li $v0, 10
syscall
The three numbers are user inputted into $t0, $t1, and $t2.