Question: MIPS programming. I want to find a subroutine to check whether an input integer is a perfect square. My strategy is compute the square of
MIPS programming.
I want to find a subroutine to check whether an input integer is a perfect square.
My strategy is compute the square of integer from 1 and incrementing the number. Until the i^2 no longer smaller than the input. we can check whether is equal or larger than some i^2. But it does not run as what is expected 
square: add $t0, $zero, $a0 slt $t8, $zero, $t0 beq $t8, $zero, edge addi $t1, $zero, 1 # a = input # if 0
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
