Answered step by step
Verified Expert Solution
Question
1 Approved Answer
output should look like this: For the prelab assignment, you are to write a function called myPow() to calculate the result of raising a positive
output should look like this:
For the prelab assignment, you are to write a function called myPow() to calculate the result of raising a positive integer to a positive power. You may not call any function from math.h in your implementation of the myPow() function. However, you can call functions in math.h (such as the pow() function) in your main() for testing purposes. In your main, you should show that raising each integer from 1 to 6 to the powers 0 to 5 gives the same result in your function as the result given by the pow() function. See sample output below. Functions You Must Write You may write any functions you wish to implement this program, in addition to the following functions. However, you must implement the following functions: int myPow(int x, int y) This function returns x raised to the y power. int main(void) - Of course, you need to write a main(). . myPow(1,@)-1 pow(1,0)-1 myPow(1,1)=1 pow(1,1)-1 myPow(1,2)-1 pow(1,2)-1 myPow(1,3)-1 pow(1,3)-1 myPow(1,4)-1 pow(1,4)-1 myPow(1,5)-1 pow(1,5)-1 myPow(2, @)-1 pow(2,@)-1 myPow(2, 1)-2 pow(2,1)-2 myPow(2, 2)=4 pow(2,2)=4 myPow(2,3)=8 pow(2,3)-8 myPow(2,4)-16 pow(2,4-16 myPow(2,5)=32 pow(2,5)-32 myPow(3, @)-1 pow(3,0)=1 myPow(3, 1)-3 pow(3, 1)-3 myPow(3,2)-9 pow(3,2)-9 myPow(3, 3)-27 pow(3,3)-27 myPow(3,4)-81 pow(3,4)=81 myPow(3,5)243 pow(3,5)=243 myPow(4,0)=1 pow(4,0)=1 myPow(4,1)-4 pow(4,1)-4 myPow(4,2)-16 pow(4,2)-16 myPow(4,3)=64 pow(4,3)-64 myPow(4,4)-256 pow(4,4)-256 myPow(4,5)-1024 pow(4,5)-1024 myPow(5,0)=1 pow(5,0)-1 myPow(5,1)=5 pow(5,1)=5 myPow(5,2)-25 pow(5,2)-25 myPow(5,3)-125 pow(5,3)-125 myPow(5,4)=625 pow(5,4)=625 myPow(5,5)=3125 pow(5,5)=3125 myPow(6,6)=1 pow(6,0)=1 myPow(6,1)=6 pow(6, 1)-6 myPow(6,2)=36 pow(6,2)-36 myPow(6,3)=216 pow(6,3)-216 myPow(6,4)=1296 pow(6,4)=1296 myPow(6,5) -7776 pow(6,5)=7776Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started