2. PHP Program to calculate Multiplication and Division of two numbers.
How does this program work?
- In this program you will learn about how to find Multiplication and Division of two numbers using PHP.
- Initially The integer entered by the user is stored in two variables a,b.
- After that by using the given formula you will get the output.
Here is the code
<html>
<head>
<title>PHP Program To calculate Multiplication and Division of two numbers</title>
</head>
<body>
<form method="post">
<table border="0">
<tr>
<td><input type="text" name="num1" value="" placeholder="Enter a value"/></td>
</tr>
<tr>
<td><input type="text" name="num2" value="" placeholder="Enter b value"/></td>
</tr>
<tr>
<td><input type="submit" name="submit" value="Submit"/></td>
</tr>
</table>
</form>
<?php
if(isset($_POST['submit']))
{
$a = $_POST['num1'];
$b = $_POST['num2'];
$mul = $a * $b; // Multiplication of two numbers
$div = $a/$b; // Division of two numbers
echo "Multiplication of two numbers : $a * $b = ".$mul;
echo "Division of two numbers : $a / $b = ".$div;
}
?>
</body>
</html>