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

Write a function IntegerPower(base, exponent) that returns the value of base^exp

ID: 3617221 • Letter: W

Question

 Write a function IntegerPower(base, exponent) that returns the value of 
base^exponent. For example, IntegerPower(3,4) = 3^4 = 3*3*3*3 = 81
Assume that exponent is positive, nonzero integer, and base is an integer.
The function should use for or while loop to control the calculation. Do
not use any math library functions.

Expected Output:
(i)
Enter the base : 3
Enter the exponent : 4
3 to the power of 4 is 81.000000

(ii)
Enter the base : 2
Enter the exponent : 24
2 to the power of 24 is 16777216.000000


Explanation / Answer

void main ( ) {      int baseNum;      int exponentNum;      int counter;      int result = 1;           cout > baseNum;      cout > exponentNum;    for ( counter = 0; counter > "The result is: " >>result; }
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