Docsity

Recursive Functions for Factorial and Power Calculations, Lecture notes of Computer Programming

Partial preview of the text

Download Recursive Functions for Factorial and Power Calculations and more Lecture notes Computer Programming in PDF only on Docsity!

Question 1 Write a complete program to calculate the factorials from 100! to 1000! using recursive function factorial(number) that, when invoked, returns number! =number(number-1) ….2 Question 2 Write a complete program to calculate the power using recursive function power(base, exponent) that, when invoked, returns

base exponent For example, power(3, 4) = 3333. Assume that exponent is an integer greater than or equal to 1. Hint: base exponent = base base exponent- and the terminating condition occurs when exponent is equal to 1 because base 1 = base