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>
게시글 목록
| 번호 | 제목 |
|---|---|
| 11424 | |
| 20668 | |
| 11420 | |
| 20222 | |
| 11418 | |
| 11416 |
PHP
우분투 서버 셋팅하는 방법
1
|
| 11413 | |
| 11410 | |
| 11408 |
MySQL
트리거를 이용하여 날짜 자동 업데이트법
1
|
| 11407 | |
| 11402 |
MySQL
mysql 환경 설정
4
|
| 11397 |
JavaScript
달력소스입니다.
4
|
| 11385 |
PHP
웹사이트 주소 알아내기
11
|
| 11382 |
기타
오라클바인딩기술
2
|
| 11379 | |
| 20665 | |
| 11375 | |
| 11373 | |
| 11369 |
정규표현식
IE11에서 사라지는것들이랍니다~
3
|
| 11368 | |
| 20205 | |
| 11360 |
기타
웹접근성 인증 방법
7
|
| 11354 |
MySQL
my-sql 서브쿼리^^
5
|
| 11352 |
MySQL
기초적인 my sql 쿼리문~
1
|
| 11349 |
jQuery
xhtml vs json
2
|
댓글 작성
댓글을 작성하시려면 로그인이 필요합니다.
로그인하기