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>
게시글 목록
| 번호 | 제목 |
|---|---|
| 10224 |
JavaScript
흔한 트위터,페이스북 퍼가기 자바스크립트
1
|
| 10217 |
Linux
리눅스 FFMPEG 자동실행소스(자작임)
6
|
| 17559 | |
| 10202 |
PHP
웹 소스 긁어오기
14
|
| 10201 | |
| 17557 | |
| 10198 |
Mobile
스마트폰에서 영상소스는?
2
|
| 19955 |
HTML
레이아웃이 비뚤합니다.
3
|
| 17556 | |
| 10195 |
정규표현식
정규식으로 html 태그 지우기
2
|
| 10192 |
jQuery
이미지 슬라이더 만들어보았습니다.
2
|
| 10190 |
jQuery
순차애니메이션 질문좀 드리겠습니다.
1
|
| 10189 | |
| 10186 | |
| 10185 | |
| 10182 | |
| 10180 | |
| 10178 |
node.js
node.js 0.8.2 번역 문서
1
|
| 10176 |
jQuery
CSS3처럼 이미지 라운딩 기능의 제이쿼리
1
|
| 10174 |
jQuery
이 플래시메뉴처럼 바꿔 만들려면...
1
|
| 10173 | |
| 10170 |
Mobile
가로 폭 문제
2
|
| 10168 |
MySQL
MySQL 테이블명 대소문자 구분안하기
1
|
| 10161 | |
| 10160 |
Flash
플래시 네비 관련
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기