Problem # 21 : Exponential raise

Write a function RAISE(x y) which returns the value of x raised to the power of y.
'x' and 'y' may be any real numbers. Return 0 if the solution is not defined ie if x=0 and y=0.

Do this without the inbuilt procedures in your compiler (eg: POW function in C++ carat ^ sign in Qbasic etc.!) ... Duh!

Sample Output
     RAISE(2 3) returns 8
     RAISE(2 .5) returns 1.414214
     RAISE(27 .33333333) returns 3
     RAISE(-2 3) returns -8
     RAISE(99 0) returns 1
     RAISE(4 -1) returns 0.25
     RAISE(0 99) returns 0


Previous Problem
Return to problems at The Vault
(Back to problems at The Vault )
Next Problem

LinkExchange
LinkExchange Member
1