Question: Write a MIPS program that determines if 3 numbers that are entered, by the user, are sides of a right triangle. remember any combination of

Write a MIPS program that determines if 3 numbers that are entered, by the user, are sides of a right triangle.

remember any combination of numbers can be entered, 3 4 5, 5 4 3, 4 3 5 ... are all the same right triangle.

you must have a function that does exponentiation,

one that does input one that does output.

and one that does the comparisons

the main will be this code

main: jal allwork li $v0,10 syscall

function allwork will call function input which will ask the user for a number,

input will call function pow which will square the number (it must work with any exponent >=0)

allwork will also call function check, which will check if it's a right triangle,

and function print, which will output if it is a right triangle or not.

some of these functions will be called more than once

you will need the stack to manage the nested functions, and their return address

Please write a MIPS code that will run in QtSpim correctly.

Program output should look like this:

Enter value for A side: 5

Enter value for B side: 4

Enter value for C side: 3

5 , 4 , 3 - is a Right Triangle

Enter value for A side: 15

Enter value for B side: 8

Enter value for C side: 17

15 , 8 , 17 - is a right triangle

Enter value for A side: 5

Enter value for B side: 6

Enter value for C side: 3

5 , 6 , 3 - is NOT a right triangle

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!