Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this program, you should write and test a function that raises the first num

ID: 3685336 • Letter: F

Question

For this program, you should write and test a function that raises the first number to the power of the second number. The prototype should be as follows:

int toThePowerOf(int base, int exponent);

Your implementation of toThePowerOf SHOULD NOT use pow() and the function only needs to work with positive integers.

Write the main() in such a way that it asks the two numbers from the user and validates them to make sure they are positive integers. Then, it should call the function and display the output of calling the function as well as what calling pow() on the same two numbers gives you.

Explanation / Answer

#include void toThePowerOf(int a, int b); void main() { int a,b; clrscr(); printf(“Enter the base: “); scanf(“%d”,&a); printf(“Enter the power: “); scanf(“%d”,&b); while (b!=0) { power(a,b); getch(); } void power(int a, int b) { int c; c=a; for(i=1;i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote