Question: MATLAB question: Write a recursive function getGCD to calculate the greatest common denominator of two given numbers. For example. getGCD(12, 9) = 3. The function

MATLAB question:

MATLAB question: Write a recursive function getGCD to calculate the greatest common

Write a recursive function getGCD to calculate the greatest common denominator of two given numbers. For example. getGCD(12, 9) = 3. The function should have the following declaration: function gcd = getGCD(n1, n2) where inputs n1 and n2 are positive integers and output gcd is the greatest common denominator of n1 and n2. The function should have a description. When the inputs are not positive integers, set the output to be a string 'Error' and use return to exit the function. (a) Set p4a = evalc('help getGCD'). (b) Find the greatest common denominator of -232432 and 345525. Put the answer to p4b. (c) Find the greatest common denominator of 0 and 345525. Put the answer to p4c. (d) Find the greatest common denominator of 0 and -232432. Put the answer to p4d. (e) Find the greatest common denominator of 525 and 345525. Put the answer to p4e

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!