pow() 方法用於返回第一個參數的第二個參數次方
double pow(double base, double exponent)
參數
-
base -- 任何原生數據類型
-
exponent -- 任何原生數據類型
public class Test{ public static void main(String args[]){ double x = 11.635; double y = 2.76; System.out.printf("e 的值為 %.4f%n", Math.E); System.out.printf("pow(%.3f, %.3f) 為 %.3f%n", x, y, Math.pow(x, y)); } }