Programming/[JSP]
[JSP] 구구단 출력
iD이드
2018. 4. 11. 15:18
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
<%@ 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>구구단</title>
</head>
<body>
<center>
<h2>구구단</h2>
<hr>
<table border="1">
<%
for(int i=0; i<10; i++) {
%>
<%="<tr>" %>
<%
for(int j=1; j<10; j++) {
%><%if(i==0 && j==1) {%>
<%="<td bgcolor=red width=80></td>" %> <%
} else if(j==1) {%>
<%= "<td align=center bgcolor=red width=80>" + i + "</td>" %>
<%} else if(i==0) {
%><%="<td align=center bgcolor=red width=80>" + j + "단" + "</td>"%> <%
} else {%>
<%="<td align=center width=80>" + j + " X " + i + " = " + i*j + "</td>"%>
<%}%>
<% }%> <%="</tr>" %>
<%} %>
</table>
</center>
</body>
</html>
|
cs |