
โ
๋ฌธ์ 2๊ฐ์ ์ ์ base, n์ ์
๋ ฅ ๋ฐ๊ธฐbase์ n์ ๊ณฑ ๋ฐํํ๋ powerN() ๋ฉ์๋ ๋ง๋ค๊ธฐโ
์ฝ๋public class bonus06 { public static void main(String[] args) { System.out.println(powerN(2, 3)); } public static int powerN(int base, int n) { int result = 1; for (int i = 0; i ๋ฉ์๋๋ Main ์์ญ ๋ฐ์์ ๋ง๋ค์ด ์ค๋ค.๋งค๊ฐ๋ณ์ 2 ๊ฐ: base์ nresult ๋ณ์๋ฅผ 1๋ก ์ด๊ธฐํ (๊ฒฐ๊ณผ ์ ์ฅํ ๋ณ์)for ๋ฃจํ๋ฅผ ์ฌ์ฉํ์ฌ base๋ฅผ n๋ฒ ๊ณฑํ๋ค. ๋ฃจํ๊ฐ ํ ๋ฒ ์คํ๋ ๋๋ง๋ค result์ base๋ฅผ ๊ณฑํด..