+ 3

How can i code a formula with power without using math.pow?

java basic

11th Dec 2016, 2:06 PM
mark daquis
mark daquis - avatar
2 ответов
+ 6
public static int power(int base, int exponent) { int result = base; for (int x = 1; x < exponent; ++x) { result *= base; } return result; }
11th Dec 2016, 2:17 PM
Kerrash
Kerrash - avatar
0
thanks
11th Dec 2016, 5:19 PM
mark daquis
mark daquis - avatar