Question: Write a program that has the following two recursive functions: 1) Recursive Conversion (iteration converted to recursion) Convert the following function to one that uses

Write a program that has the following two recursive functions:

1)

Recursive Conversion (iteration converted to recursion)

Convert the following function to one that uses recursion.

void sign ( int n )

{

while ( n > 0)

cout<< No Parking ;

n-;

}

2)

Greatest Common Divisor

Euclids algorithm, the GCD of two positive integers, x and y is :

x if y=0

gcd (x,y) =

gcd (y, x%y) if != 0

Write a recursive function, gcd, that takes as parmaters two integers and returns the greatest common divisor of the numbers.

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!