update,
This commit is contained in:
18
_resources/it114105/itp4513/Lab02/Lab02_Task1.php
Normal file
18
_resources/it114105/itp4513/Lab02/Lab02_Task1.php
Normal file
@@ -0,0 +1,18 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab02 Task1</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
for ($i=1; $i < 11; $i++) {
|
||||
printf("%s * %s is %d<br>", $i, $i, ($i*$i));
|
||||
}
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
37
_resources/it114105/itp4513/Lab02/Lab02_Task2.php
Normal file
37
_resources/it114105/itp4513/Lab02/Lab02_Task2.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab02 Task2</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
$mathMark = array(70, 40, 60, 50, 20, 30, 10, 100, 80, 90);
|
||||
$i = 0;
|
||||
do {
|
||||
echo "$mathMark[$i] ";
|
||||
$i++;
|
||||
} while ($i < count($mathMark) );
|
||||
|
||||
$max = $mathMark[0];
|
||||
$i = 1;
|
||||
while($i < count($mathMark)){
|
||||
if ($max < $mathMark[$i])
|
||||
$max = $mathMark[$i];
|
||||
$i++;
|
||||
}
|
||||
printf("<br>Maximum mark: %d", $max);
|
||||
|
||||
$min = $mathMark[0];
|
||||
for($i = 1; $i < count($mathMark); $i++){
|
||||
if($min > $mathMark[$i])
|
||||
$min = $mathMark[$i];
|
||||
}
|
||||
printf("<br>Minimum mark: %d", $min);
|
||||
|
||||
?>
|
||||
</body>
|
||||
</html>
|
28
_resources/it114105/itp4513/Lab02/Lab02_Task3.php
Normal file
28
_resources/it114105/itp4513/Lab02/Lab02_Task3.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Lab02 Task3</title>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
$num = array(1, 1);
|
||||
?>
|
||||
<table border="1">
|
||||
<?php
|
||||
for($i=1; $i < 20; $i++){
|
||||
echo "<tr>";
|
||||
|
||||
printf("<td>%d</td>", $num[$i-1]);
|
||||
printf("<td>%d</td>", $num[$i]);
|
||||
printf("<td>%d</td>", $num[$i-1]+$num[$i]);
|
||||
|
||||
echo "</tr>";
|
||||
array_push($num, $num[$i-1]+$num[$i]);
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
Reference in New Issue
Block a user