Question: I need help creating an MIPS program that takes a user's input of three positive integers and outputs their greatest common prime factor. I have
I need help creating an MIPS program that takes a user's input of three positive integers and outputs their greatest common prime factor.
I have this so far but when instruction reaches the loop I get an error.
.data 11 prompt: .asciiz "Enter 3 positive numbers: " messagel: .asciiz " First integer: message2: .asciiz " Second integer: message3: .asciiz " Third integer: message4: .asciiz " The Greatest Common Prime Factor is: 11 cd: .text #Prompt user message li $ve, 4 la $ao, prompt syscall #Prompt user to enter first integer li $v0, 4 la $ao, message1 syscall #Read user input li $v0, 5 syscall #Store integer move Sto, $ve #Prompt user to enter second integer li $v0, 4 la $ao, message2 syscall #Read user input li $v0, 5 syscall #Store integer move $t1, $ve 1 #Prompt user to enter third number li $v0, 4 la $ao, message3 syscall #Read user input li $v0, 5 syscall #Store integer move $t2, $ve loop : beq $t1, $o, done div $t1,$t1 move Sto, $t1 mfhi $t1 j loop done: #Display message li $v0, 4 la $ao, message4 syscali #Print the Greatest Common Prime Factor move $v0, $to jr Sra syscall
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
