code.cpp 258 B

1234567891011
  1. /* Create a function that takes a base number
  2. * and an exponent number and returns the calculation.
  3. */
  4. double calculateExponent(double num1, double num2) {
  5. int x = int(num2)-1;
  6. double y = num1;
  7. for (int i = 0;i<x;i++){
  8. num1 *= y;
  9. }
  10. return num1;
  11. }