-
Notifications
You must be signed in to change notification settings - Fork 1
/
arithmetic.php
95 lines (77 loc) · 1.57 KB
/
arithmetic.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
91
92
93
94
95
<?php
//write a program to add two numbers -
//arithmetic
/*
+ -sum
- substraction
/ - division
* - multiplications
% - modulus 3%2 -
*/
//write a program to add numbers
$x =55;
$y = 35;
echo "Value of X - $x and Y - $y";
$sum = $x+$y;
$substraction = $x-$y;
$division = $x/$y;
$multiplications = $x*$y;
$modulus = $x%$y;
$power = $x**$y; //35^55
echo "<br>Sum is ".$sum;
echo "<br>substraction is ".$substraction;
echo "<br>division is ".$division;
echo "<br>multiplications is ".$multiplications;
echo "<br>Modulus of $x and $y = <b style='color:red;'>$modulus</b>";
echo "<br>";
?>
<!DOCTYPE html>
<html>
<head>
<title>Math Ops</title>
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-BmbxuPwQa2lc/FVzBcNJ7UAyJxM6wuqIj61tLrc4wSX0szH/Ev+nYRRuWlolflfl" crossorigin="anonymous">
</head>
<body>
<div class="container">
<h2>Math Operations of <?php echo "$x and $y"; ?></h2>
<div class="col-6">
<table class="table">
<tr>
<th>Operation</th>
<th>Results</th>
</tr>
<tr>
<td>Sum</td>
<td>
<?php echo $sum; ?>
</td>
</tr>
<tr>
<td>Division</td>
<td>
<?php echo $division; ?>
</td>
</tr>
<tr>
<td>Multiplications</td>
<td>
<?php echo $multiplications; ?>
</td>
</tr>
<tr>
<td>Modulus</td>
<td>
<?php echo $modulus; ?>
</td>
</tr>
<tr>
<td>Exponential</td>
<td>
<?php echo $power;?>
</td>
</tr>
</table>
</div>
</div>
</body>
</html>