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>
게시글 목록
| 번호 | 제목 |
|---|---|
| 20064 | |
| 10570 | |
| 10566 |
JavaScript
모바일웹 이미지맵 사용 소스
3
|
| 10565 |
JavaScript
[복사하기] 버튼 자료~
|
| 20055 | |
| 10560 |
PHP
php 동영상 강좌
4
|
| 10559 |
jQuery
array toggle
|
| 10557 | |
| 20051 |
HTML
IE6 PNG 초 간단하게 적용
3
|
| 20049 | |
| 10555 | |
| 10554 | |
| 10553 | |
| 284 | |
| 10552 | |
| 10551 | |
| 10545 |
jQuery
참고사이트 모음
5
|
| 10541 | |
| 10533 | |
| 20045 | |
| 20036 | |
| 10530 | |
| 10526 | |
| 10524 | |
| 10522 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기