Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Object Oriented Databases Prentice Hall International Series In Computer Science

Authors: John G. Hughes

1st Edition

0136298745, 978-0136298748

Students also viewed these Databases questions