๊ฑฐ๋ญ์ ๊ณฑ
![[์๋ฐ/Java] 2๊ฐ์ ์ ์ base, n์ ์
๋ ฅ ๋ฐ์ base์ n ์ ๊ณฑ ๋งํผ ๊ฐ์ ๋ฐํํ๋ powerN() ๋ฉ์๋๋ฅผ ์์ฑํ๊ธฐ](https://img1.daumcdn.net/thumb/R750x0/?scode=mtistory2&fname=https%3A%2F%2Fblog.kakaocdn.net%2Fdn%2FmamMV%2Fbtrd2jTmz6g%2FIu8wGhiT4KZkszwjiLLOo1%2Fimg.png)
[์๋ฐ/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