Question: Write a C program that calculates the power of a number, like 2^3 = 8. Here are the requirements: 1) get two numbers, a base
Write a C program that calculates the power of a number, like 2^3 = 8. Here are the requirements:
1) get two numbers, a base and a power as user input.
2) of either number is less than 0 l, print error
3) otherwise, print result of base^power
4) In main() promipt the user for the input, and
5) put calculations in a separate function, let's say power()
6) make power() a recursive function (doing one multiplication operation each time)
7) document your code (all functions) with preconditions and postconditions
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
