Question: Using this prewritten program below, I have to make both an iterative and recursive function: #include #include #include /* function prototypes */ int iterGCD(int x,

 Using this prewritten program below, I have to make both an

Using this prewritten program below, I have to make both an iterative and recursive function: #include #include #include

/* function prototypes */ int iterGCD(int x, int y); int recGCD(int x, int y);

int main(int argc, char *argv[]) { int num_vals = 6; int x_vals[] = {3, 9, 12, 36, 1, 105}; int y_vals[] = {3, 21, 18, 27, 12, 91}; int i = 0; printf("Assignment 2 Problem 2 by . "); while (i

int iterGCD(int x, int y) { return -1; }

int recGCD(int x, int y) { return -1; }

2. Recursion in C (15 points) The greatest common divisor (GCD) of two numbers is the largest number which divides both of them (e.g., GCD(20, 15-5, GCD(20, 20) = 20, GCD(20.9-1, ). We define the GCD as follows: GCD(z, y) = y GCD(z, y) = GCD(y,z) GCD(z,y) = GC D(y, x%y) if(y

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!