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에서 해주시기 바랍니다.
| 번호 | 제목 | 글쓴이 | 날짜 | 조회 |
|---|---|---|---|---|
| 4702 |
phpman
|
13년 전 | 862 | |
| 4701 | 13년 전 | 1261 | ||
| 4700 |
phpman
|
13년 전 | 848 | |
| 4699 |
PHPㅡASP프로그래머
|
13년 전 | 1055 | |
| 4698 | 13년 전 | 729 | ||
| 4697 | 13년 전 | 1826 | ||
| 4696 |
PHPㅡASP프로그래머
|
13년 전 | 772 | |
| 4695 |
|
13년 전 | 1620 | |
| 4694 | 13년 전 | 806 | ||
| 4693 | 13년 전 | 700 | ||
| 4692 | 13년 전 | 614 | ||
| 4691 | 13년 전 | 980 | ||
| 4690 | 13년 전 | 773 | ||
| 4689 | 13년 전 | 712 | ||
| 4688 | 13년 전 | 777 | ||
| 4687 | 13년 전 | 1329 | ||
| 4686 | 13년 전 | 862 | ||
| 4685 | 13년 전 | 1263 | ||
| 4684 | 13년 전 | 4224 | ||
| 4683 |
ckflower
|
13년 전 | 2429 | |
| 4682 |
ddokkani
|
13년 전 | 1358 | |
| 4681 | 13년 전 | 1570 | ||
| 4680 | 13년 전 | 653 | ||
| 4679 |
밤거리빵빵
|
13년 전 | 5939 | |
| 4678 |
PHPㅡASP프로그래머
|
13년 전 | 937 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기