Question: How do you code this in matlab ? Page Ofe o 6 Greatest Common Divisor (GCD) Input function GCD = greatestCommonDivisor (a, b) Type Description
Page Ofe o 6 Greatest Common Divisor (GCD) Input function GCD = greatestCommonDivisor (a, b) Type Description 1x1 double an integer greater than or equal to 0 1xl double an integer greater than or equal to 0 Output Type Description GCD 1x1 double the GCD of a and b Details Recall that the greatest common divisor (GCD) is the largest positive integer that evenly divides two integers. In this problem, you will write a function that recursively finds the GCD of two input integers. Do not use the built-in MATLAB function ged(). Tips The GCD of two integers should not change if the smaller integer is subtracted from the bigger integer. Don't forget to program in for cases where a or b=0. If a and b are both equal to zero, your program should display(disp) a message to remind users that the input is invalid
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
