Write a PHP script to display the squares and cubes of 1 to 10 number
Answers
Answered by
16
Answer:
<!doctype html>
<html>
<head>
<title>Square and Cube of Integers 1-10</title>
</head>
<body>
<table border=1>
<tr>
<th>Integers 1 to 10</th>
<th>Square</th>
<th>Cube</th>
</tr>
<?php
//Square and Cube
for ($i = 1; $i <= 10; $i++) {
$a = $i*$i;
$b = $i*$i*$i;
echo "<tr>";
echo "<td>" . $i . "</td>";
echo "<td>" . $a . "</td>";
echo "<td>" . $b ."</td>";
echo "</tr>";
}
?>
</table>
</body>
</html>
This PHP script will display the squares and cubes of 1 to 10 numbers.
Similar questions