/* File: power.c Compute a raised to power b. */ #include #include "genlib.h" #include "simpio.h" #include "math.h" double power(double base, double exponent) ; main(){ double a, b ; while(TRUE) { printf("Base? ") ; a = GetReal() ; if (a < 0) break ; printf("Exponent? ") ; b = GetReal() ; printf("%g raised to the power of %g is: %g\n", a, b, power(a,b) ) ; } } double power(double base, double exponent) { return( exp ( exponent * log(base) ) ) ; }