Answer to Question #154023 in C++ for asmaa

Question #154023

function integer power ( base , exponent ) that returns the value of base exponent

1
Expert's answer
2021-01-06T08:15:32-0500
#include <iostream>
#include <cmath>
using namespace std;
long integer_power (int base, int exponent) {
  return pow(base, exponent);
}
int main () {
  int a, b;
  cout << "Enter a base: "; cin >> a;
  cout << "Enter a exponent: "; cin >> b;
  cout << "The " << a << "^" << b << " = " << integer_power(a, b);
  return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog