선언부를 이용한 덧셈, 제곱 - soonbeankim/web1 GitHub Wiki

<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>선언부를 이용한 덧셈</title>
</head>
<body>

	2+1=<%= decadd(2,1) %><br/>
	3+1=<%= decadd(3,1) %><br/>
	4+1=<%= decadd(4,1) %><br/>
	5+1=<%= decadd(5,1) %><br/>
	<hr>
	2^0=<%= square(2,0) %><br/>
	2^1=<%= square(2,1) %><br/>
	2^2=<%= square(2,2) %><br/>
	2^3=<%= square(2,3) %><br/>	
	2^4=<%= square(2,4) %><br/>
	2^5=<%= square(2,5) %><br/>
	
</body>
</html>

<%!
	private int decadd(int num1, int num2){
	int result= num1+num2;
	return result;
}

	private int square(int num1, int num2){
	int result=1;
	for(int i=1; i<=num2; i++){
		result=result*num1;
			}
	return result;
	}
%>	
		

⚠️ **GitHub.com Fallback** ⚠️