Mon May 18 2020

Arithmetic Operations

PHP Scripting1101 views

File Name: php-arithmetic-calculation.php

<?php
	/* initialization of variables */
	$a = 13;
	$b = 2;
	
	/* Calculation of Sum */
	$sum = $a + $b;
	
	/* Calculation of Subtract */
	$sub = $a - $b;
	
	/* Calculation of Multiplication */
	$mul = $a * $b;
	
	/* Calculation of Division */
	$div = $a / $b;
	
	/* Calculation of Modulus */
	$mod = $a % $b;
	
	echo "Sum: ".$sum;
	echo "<br />Subtract: ".$sub;
	echo "<br />Multiplication: ".$mul;
	echo "<br />Division: ".$div;
	echo "<br />Modulus: ".$mod;
?>




/* Output */
Sum: 15

Subtract: 11

Multiplication: 26

Division: 6.5

Modulus: 1

We use cookies to improve your experience on our site and to show you personalised advertising. Please read our cookie policy and privacy policy.