Question: Write a program in RISC-V to implement the following recursive methods Exercise ex3a: Implement a recursive procedure gcd (a,b) that uses the Euclid's algorithm to

Write a program in RISC-V to implement the following recursive methods Exercise ex3a: Implement a recursive procedure gcd (a,b) that uses the Euclid's algorithm to find the greatest common divisor of two positive integers a and b. referring to the following pseudo code: gcd (x, y) { if (y = 0) return x; else god (y, x%y); Write a main program that i) asks the user to enter two positive integers a and b, ii) calls the recursive procedure gcd (a,b) to find their greatest common divisor, and iii) outputs the calculated result Exercise ex3b: Implement the tail recursive version of the Fibonacci procedure corresponding to the following pseudo code: fiban, a = 0, b = 1) { if (n == 0) return a; if (n == 1) return b; return fib(n - 1, b, a + b)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
