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