Home » Blog » Arithmetic, Logical And Comparison Operation

# Arithmetic, Logical And Comparison Operation

• PHP

Here, Dot(.) is used to concate the statements. <br> tag is used to break the line.

```<?php
\$a=10;
\$b=20;
echo "Value of a = \$a"."<br>";
echo "Value of b = \$b"."<br>";

echo "<br> ***Arithmetic Operator*** <br>";

\$c=\$a+\$b;
echo "Addition of \$a and \$b = \$c"."<br>";

\$c=\$a-\$b;
echo "Subtraction of \$a and \$b = \$c"."<br>";

\$c=\$a*\$b;
echo "Multiplication of \$a and \$b = \$c"."<br>";

\$c=\$a/\$b;
echo "Division of \$a and \$b = \$c"."<br>";

echo "<br> ***Comparison Operator*** <br>";

if(\$a>\$b)
{
echo "\$a is greater than \$b <br>";
}
else if(\$a<\$b)
{
echo "\$a is less then \$b <br>";
}
else if(\$a==\$b)
{
echo "\$a and \$b is same <br>";
}

echo "<br> ***Logical Operator*** <br>";

if(\$a>0 && \$a<50)
{
echo "\$a is between 0 and 50 <br>";
}
else if(\$a>50 && \$a<100)
{
echo "\$a is between 50 and 100 <br>";
}
?>
```

OutPut

```Value of a = 10
Value of b = 20

***Arithmetic Operator***
Addition of 10 and 20 = 30
Subtraction of 10 and 20 = -10
Multiplication of 10 and 20 = 200
Division of 10 and 20 = 0.5

***Comparison Operator***
10 is less then 20

***Logical Operator***
10 is between 0 and 50
```