Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Having problems with my recursion question looking for solution with comments

Thomas GreenThomas Green Member Posts: 2

Comments

  • Thomas GreenThomas Green Member Posts: 2

    For this programming assignment # 6, you need to submit ONE source code file.
    1.(Recursive Exponentiation) Write a recursive function power(base, exponent) that when invokedreturns
    baseexponent
    For example, power(3, 4) = 3 * 3 * 3 * 3. Assume that exponent is an integer greater than or equal to 1. Hint: The recursion step would use the relationship
    baseexponent = base * baseexponent-1
    and the terminating condition occurs when exponent is equal to 1 because
    base1 = base
    2.(Recursive Greatest Common Divisor) The greatest common divisor of integers x and y is the largestinteger that evenly divides both x and y. Write a recursive function gcd that returns the greatest commondivisor of x and y. The gcd of x and y is defined recursively as follows: If y is equal to 0, then gcd(x, y) isx; otherwise gcd(x, y) is gcd(y, x % y), where % is the remainder operator.
    3.(Find the Minimum Value in an array) Write a recursive function recursiveMinimum that takes aninteger array and the array size as arguments and returns the smallest element of the array. The functionshould stop processing and return when it receives an array of one element.
    4.Write the int main(void) function as a driver program and call the above three functions result withsample Input/Output.

  • B00B00 Member Posts: 85 ✭✭✭

    You have a solution for every task written in assignment itself, you just have to write basic things like input/output and piece everything together.

Sign In or Register to comment.