Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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 p4eStep 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