Question: Please do each task separately in MIPS. Lab Task 1 [2 marks] In this task, you need to implement the square function. This is extremely
Please do each task separately in MIPS.
Lab Task 1 [2 marks]
In this task, you need to implement the square function. This is extremely simple task. Function Prototype: Input: integer Return value: square of integer Lab
Task 2 [3 marks] In this task, you will implement the squareRoot function. You may use any algorithm you wish or the one given below. Algorithm: 1. Create a variable (counter) i and take care of some base cases, i.e when the given number is 0 or 1. 2. Run a loop until i*i <= n , where n is the given number. Increment i by 1. 3. The floor of the square root of the number is i 1
Lab Task 3 [5 marks] In the 2nd task, you need to implement the calculateDistance function. Function Prototype: Input: 1st point, 2nd point Output: integer d = ((x2 - x1)2 + (y2 - y1)2 + (z2 - z1)2 ) To calculate the square, you need to call another function called square To calculate the square root, you need to call another function called squareRoot
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
