for문과 sprintf를 이용한 구구단표입니다.
- 소 스 -
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>구구단을 외자</title>
<style type=text/css>
td { font-size:12px; font-family:굴림체; color:#0000FF; line-height:1.3; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border=0 width=720 bgcolor=#F0F0F0>
<tr>
<?
for($dan=2; $dan<=9; $dan++) {
echo "<td align=center bgcolor=#C0C0C0>$dan 단</td>\n";
}
?>
</tr>
<?
// 구구단
for($gop=1; $gop<=9; $gop++) {
echo "<tr>";
for($dan=2; $dan<=9; $dan++) {
$format = sprintf("%d * %d = %2d", $dan, $gop, $dan * $gop);
echo "<td align=center bgcolor=#F0F0F0>$format</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
- 소 스 -
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=euc-kr">
<title>구구단을 외자</title>
<style type=text/css>
td { font-size:12px; font-family:굴림체; color:#0000FF; line-height:1.3; }
</style>
</head>
<body bgcolor=#FFFFFF>
<table border=0 width=720 bgcolor=#F0F0F0>
<tr>
<?
for($dan=2; $dan<=9; $dan++) {
echo "<td align=center bgcolor=#C0C0C0>$dan 단</td>\n";
}
?>
</tr>
<?
// 구구단
for($gop=1; $gop<=9; $gop++) {
echo "<tr>";
for($dan=2; $dan<=9; $dan++) {
$format = sprintf("%d * %d = %2d", $dan, $gop, $dan * $gop);
echo "<td align=center bgcolor=#F0F0F0>$format</td>\n";
}
echo "</tr>\n";
}
?>
</table>
</body>
</html><div class='small'>[이 게시물은 관리자님에 의해 2011-10-31 17:12:10 PHP & HTML에서 이동 됨]</div>
게시판 목록
팁게시판
디자인과 관련된 유용한 정보를 공유하세요.
질문은 상단의 QA에서 해주시기 바랍니다.
질문은 상단의 QA에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 52 | 21년 전 | 2696 | ||
| 51 |
prosper
|
21년 전 | 2342 | |
| 50 |
prosper
|
21년 전 | 2159 | |
| 49 | 21년 전 | 2168 | ||
| 48 | 21년 전 | 2302 | ||
| 47 | 21년 전 | 1924 | ||
| 46 | 21년 전 | 1933 | ||
| 45 | 21년 전 | 2136 | ||
| 44 | 21년 전 | 2391 | ||
| 43 | 21년 전 | 4588 | ||
| 42 |
prosper
|
21년 전 | 2712 | |
| 41 |
prosper
|
21년 전 | 2115 | |
| 40 | 21년 전 | 2178 | ||
| 39 | 21년 전 | 2141 | ||
| 38 | 21년 전 | 2410 | ||
| 37 | 21년 전 | 2560 | ||
| 36 | 21년 전 | 1765 | ||
| 35 | 21년 전 | 4074 | ||
| 34 | 21년 전 | 3844 | ||
| 33 | 21년 전 | 2972 | ||
| 32 |
prosper
|
21년 전 | 2875 | |
| 31 | 21년 전 | 5241 | ||
| 30 |
아우겐나이스
|
21년 전 | 4015 | |
| 29 |
아우겐나이스
|
21년 전 | 4422 | |
| 28 |
아우겐나이스
|
21년 전 | 3442 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기