九九乘法表
2010-05-05 22:00
155 查看
呵呵,非常简单,大家权当复习~~~
算法一:
算法二:
算法一:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>九九乘法表</title> </head> <body> <?php $a=1; $b=1; echo '<table border="0" cellpadding="4" cellspacing="1" bgcolor="#FFFFFF">'; while($a<=9) { echo '<tr>'; while($b<=$a) { echo '<td bgcolor="#FFFFFF"> </td>'; $c=$a*$b; echo '<td bgcolor="#FFFFFF">'."{$a}*{$b}={$c} ".'</td>'; $b++; } echo"<br>"; echo "</tr>"; $b=1; $a++; } echo '</table>'; ?> </body> </html>
算法二:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>九九乘法表</title> </head> <body> <?php echo '<table border="0" cellpadding="4" cellspacing="1" bgcolor="#CCCCCC">'; for($i = 1; $i <= 9; $i++) { echo '<tr>'; for ($k = 1; $k <= (9 - $i); $k++) { echo '<td bgcolor="#FFFFFF"> </td>'; } for($j = 1; $j <= $i; $j++) { echo '<td bgcolor="#FFFFFF">' . $i . '*' . $j . '=' . $i * $j . '</td>'; } echo "</tr>"; } echo '</table>'; ?> </body> </html>
相关文章推荐
- 九九乘法表!(用C写的)
- 一条SQL生成九九乘法表
- PL/SQL輸出--九九乘法表
- [Codemo]while 九九乘法表
- 九九乘法表(vb)
- 九九乘法表
- 九九乘法表
- 九九乘法表
- 循环的嵌套-打印九九乘法表
- 【软件性能测试-LoadRunner实战技能 11】== LoadRunner Java 九九乘法表
- 输出100以内的所有质数--九九乘法表--作业
- 采用递归实现九九乘法表
- 用标准标签库写的九九乘法表(带渐变颜色)
- Java 之 九九乘法表
- python--九九乘法表
- JLabel显示图片,及其它使用方法。。。实现九九乘法表
- 使用C语言打印九九乘法表
- 九九乘法表
- 九九乘法表(Java版)
- 九九乘法表。