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>
게시글 목록
| 번호 | 제목 |
|---|---|
| 10624 |
jQuery
Easing Functions Cheat Sheet
|
| 10618 | |
| 10614 | |
| 10607 |
jQuery
좌우 슬라이드메뉴와 상하 슬라이드 메뉴
6
|
| 10606 | |
| 10603 | |
| 10599 | |
| 20077 | |
| 10598 | |
| 10597 | |
| 10595 | |
| 10593 | |
| 10591 |
Mobile
모바일 웹 개발에 큰 도움이 되는 피모 브라우저
1
|
| 10590 |
PHP
간단한 쿠폰번호 생성
|
| 10588 |
PHP
xml 파싱 예제
1
|
| 10586 |
PHP
eval
1
|
| 17645 |
제안서
제안서 유용한 도형
13
|
| 10585 |
jQuery
롤오버+슬라이드 질문드립니다.
|
| 10584 |
jQuery
jQuery path plugin
|
| 10580 |
JavaScript
아이폰일때 상단 검색바 숨기기
3
|
| 20070 | |
| 10579 | |
| 10578 | |
| 10574 | |
| 10573 |
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기