Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Need to fix this code to run and test prime numbers data Ask_Input: .asciiz Welcome to Prime Tester Enter a number between 0 and 100:
Need to fix this code to run and test prime numbers data Ask_Input: .asciiz "\Welcome to Prime Tester Enter a number between 0 and 100: " Number: .word 4 Prime: .asciiz "\Number is Prime " notPrime: .asciiz "\Number is not Prime " .text .globl main main: la $a0, Ask_Input li $v0,4 #op code to print the value in Ask_Input syscall li $v0,5 syscall move $t1,$v0 li $t2,2 divu $t1,$t2 mfhi $t7 mflo $t3 li $t4,3 beqz $t7,printnp bge $t4,$t3,printp loop: bge $t4,$t3,printp divu $t1,$t4 mfhi $t7 beqz $t7,printnp addi $t4,$t4,2 j loop exit: li $v0,10 syscall printp: la $a0, Prime li $v0,4 #op code to print the value in Ask_Input syscall j exit printnp: la $a0, notPrime li $v0,4 #op code to print the value in Ask_Input syscall j exit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started