Wednesday 22 August 2012

How to calculate Area ,Perimeter of Rectangle ,Triangle , and Square with formula IN PHP

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>";

?>
Share This
Previous Post
Next Post

FYJC XI standard online admisson Process and declaraton of Merit list . Cut off List For prevous year also . 10 Th Results onlne declaraton Maharashtra Region .

0 comments: