FRONT-END/JSP
[JSP] 구구단 테이블
진심스테이크
2018. 4. 11. 14:43
<%@ page language="java" contentType="text/html; charset=EUC-KR"
pageEncoding="EUC-KR"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=EUC-KR">
<title>Insert title here</title>
</head>
<body>
<h2 align="center">구구단</h2>
<table align="center" border="1">
<tr bgcolor="lightgrey">
<td></td>
<%
for (int i = 2; i < 10; i++) {
%>
<td align="center" width="80"><%=i%></td>
<%
}
%>
<%
for (int i = 1; i < 10; i++) {
%>
<tr>
<td align="center" bgcolor="lightgrey" width="50"><%=i%></td>
<%
for (int j = 2; j < 10; j++) {
%>
<td align="center"><%=j%> X <%=i%>= <%=j * i%></td>
<%
}
%>
</tr>
<%
}
%>
</tr>
</table>
</body>
</html>