-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathp1015_pra01.php
90 lines (69 loc) · 1.28 KB
/
p1015_pra01.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/* $score=85;
$level='';
if($score>=90 && $score<=100){
$level="A";
}else if($score>=80 && $score<=89){
$level="B";
}else if($score>=70 && $score<=79){
$level="C";
}else if($score>=60 && $score<=69){
$level="D";
}else{
$level="E";
}
echo $level;
*/
//閏年判斷
/*
$year=2100;
if($year % 400 == 0 || ($year % 4 == 0 && $year % 100 !=0)){
echo "西元".$year . "元是閏年";
}else{
echo "西元".$year . "元不是閏年";
} */
?>
<style>
table{
border-collapse:collapse;
width:800px;
}
table td{
border:1px solid #ccc;
padding:10px;
}
</style>
<table>
<?php
for($j=1;$j<=9;$j++){
echo '<tr>';
for($i=1;$i<=9;$i++){
echo "<td> $j X $i =" . ($j*$i) . "</td>";
}
echo "</tr>";
}
?>
</table>
<hr>
<table>
<?php
$range=9;
for($j=0;$j<=$range;$j++){
echo '<tr>';
for($i=0;$i<=$range;$i++){
if($j==0 && $i==0){
echo "<td style='background:#ddd'></td>";
}else if($j==0){
echo "<td style='background:#ddd'>$i</td>";
}else{
if($i==0){
echo "<td style='background:#ddd'>" . $j . "</td>";
}else{
echo "<td>" . ($j*$i) . "</td>";
}
}
}
echo '</tr>';
}
?>
</table>