How to use sqrt in php.
Formula to calculate Area and Perimeter of Rectangle ,Triangle , and Square.
Logic to develop Code in Php.
<?php
echo"<h1>RECTANGLE</h1>";
$l=30;
$b=40;
$area=$l*$b;
$peri=2*($l+$b);
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
echo"<h1>SQUARE</h1>";
$S=30;
$peri=4*$s;
$area=$s*$s;
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
echo"<h1>TRIANGLE</h1>";
$s1=30;
$s2=40;
$s3=50;
$peri= $s1 + $s2 + $s3;
$s=0.5*$peri;
$area=sqrt($s*($s-$s1)*($s-$s2)*($s-$s3));
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
?>
Formula to calculate Area and Perimeter of Rectangle ,Triangle , and Square.
Logic to develop Code in Php.
<?php
echo"<h1>RECTANGLE</h1>";
$l=30;
$b=40;
$area=$l*$b;
$peri=2*($l+$b);
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
echo"<h1>SQUARE</h1>";
$S=30;
$peri=4*$s;
$area=$s*$s;
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
echo"<h1>TRIANGLE</h1>";
$s1=30;
$s2=40;
$s3=50;
$peri= $s1 + $s2 + $s3;
$s=0.5*$peri;
$area=sqrt($s*($s-$s1)*($s-$s2)*($s-$s3));
echo "AREA: ".$area."<br>";
echo "PERIMETER: ".$peri."<br>";
?>
0 comments: