Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // Penjumlahan
- $a = 5;
- $b = 3;
- $sum = $a + $b;
- echo $sum; // Output: 8
- // Pengurangan
- $x = 10;
- $y = 4;
- $diff = $x - $y;
- echo $diff; // Output: 6
- // Perkalian
- $p = 2;
- $q = 3;
- $product = $p * $q;
- echo $product; // Output: 6
- // Pembagian
- $m = 10;
- $n = 2;
- $division = $m / $n;
- echo $division; // Output: 5
- // Modulus (Sisa Pembagian)
- $numerator = 12;
- $denominator = 5;
- $remainder = $numerator % $denominator;
- echo $remainder; // Output: 2
- // Pangkat
- $base = 2;
- $exponent = 3;
- $power = pow($base, $exponent);
- echo $power; // Output: 8
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement