JSP 1일차 스크립트릿 연습 (풍차모양 만들기)

<%@ 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>

<%
for(int i=0; i<5; i++)
{
for(int j=0; j<i; j++)
out.print(" ");
for(int j=5; j>i; j--)
out.print("◆");
for(int j=4; j>i; j--)
out.print(" ");
for(int j=0; j<i+1; j++)
out.print("◆");
out.print("<br>");
}

for(int i=0; i<5; i++)
{
for(int j=5; j>i; j--)
out.print("◆");
for(int j=0; j<i; j++)
out.print(" ");
for(int j=0; j<i+1; j++)
out.print("◆");
out.print("<br>");
}
%>

</body>
</html>


result)

댓글 없음: