๊ฑฐ๋ญ์ ๊ณฑ
[์๋ฐ/Java] 2๊ฐ์ ์ ์ base, n์ ์ ๋ ฅ ๋ฐ์ base์ n ์ ๊ณฑ ๋งํผ ๊ฐ์ ๋ฐํํ๋ powerN() ๋ฉ์๋๋ฅผ ์์ฑํ๊ธฐ
๋ชฉํ ์ฝ๋ package JavaFestival; public class test7 { public static void main(String[] args) { // TODO Auto-generated method stub int base = 2; int n = 3; int result = powerN(base, n); System.out.println("๊ฒฐ๊ณผ ํ์ธ : " + result); } public static int powerN(int base, int n) { int result = (int)Math.pow(base, n); return result; } } ๊ฒฐ๊ณผ ๊ฒฐ๊ณผ ํ์ธ : 8