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
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