Write a function called integerPower(base, exponent) that returns the value of baseexponent For example, integerPower(3,4) = 3*3*3*3 Assume that exponent...

70.2K

Verified Solution

Question

Programming

Write a function called integerPower(base,exponent) that returns the value ofbaseexponent

For example,

integerPower(3,4) = 3*3*3*3

  • Assume that exponent is a non-zerointeger, and base is an integer.
  • Function integerPower should use forloop to control the calculation.
  • Do NOT use any math library function.
  • Inputs for this program, which arebase andexponent, have to be entered by theuser

An example of input/output dialog is shown below:

Enter Integer Base: 5Enter Integer Exponent: 35 raised to the power of 3 = 125Enter 0 if you'd like to end this program.Enter 1 if you'd like to run this program again: 1Enter Integer Base: 2Enter Integer Exponent: 42 raised to the power of 4 = 16Enter 0 if you'd like to end this program.Enter 1 if you'd like to run this program again: 0Have a nice day!

Answer & Explanation Solved by verified expert
4.4 Ratings (765 Votes)
includeusing    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students