Question: Write a program that uses a recursive function to raise a number to a power. The function should accept two arguments: the base (or number

Write a program that uses a recursive function to raise a number to a power. The function should accept two arguments: the base (or number to be raised and the exponent). Create a main function that asks the user for the base, and the exponent. Use input validation to ensure that the exponent is between 2 and 50 inclusive. (Both the base and the exponent can be integers). You cannot use the exponent operator (**) or predefined function/method for this question. Sample output is shown below: Enter the base: 2 Enter a whole number between 2 and 50: 1 Invalid. Please enter a whole number between 2 and 50: 4 2 raised to the power of 4 is 16

Step by Step Solution

3.36 Rating (146 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Its asking to write a program to raise a number to a power using a recursive function Only whole num... View full answer

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 Programming Questions!