Hi, I try to calculate this in karel, but I can't find how use exponent:
A = 2^19
B = 19^(1.6)
SQRT(a) exist, so POW(base,exp) or POWER(base,exp) should exist... but no....
EXP(a) exist, but is for 2.71828^a
Any built-in fonction?
Hi, I try to calculate this in karel, but I can't find how use exponent:
A = 2^19
B = 19^(1.6)
SQRT(a) exist, so POW(base,exp) or POWER(base,exp) should exist... but no....
EXP(a) exist, but is for 2.71828^a
Any built-in fonction?
math 101
Thank you
ROUTINE POW_INT(int_value : INTEGER; pow_value : INTEGER) : INTEGER
VAR
result : INTEGER
BEGIN
--
-- Multiply by itself until reach power of 0, if zero return 1
IF pow_value = 0 THEN
RETURN(1)
ELSE
result = int_value * POW_INT(int_value,pow_value-1)
RETURN(result)
ENDIF
END POW_INT