PHP program to enter the base and height of a triangle and find its area
PHP program to enter the base and height of a triangle and find its area.
There are you will learn how to find the area of a triangle by using the base & height of the triangle in PHP language.
a = (b + h) / 2
a = area
b = base
h = height
Let us understand this example through the PHP program:
<?php // PHP program to find the area of a triangle if base and height are given $b = 5; $h = 7; $a = NULL; // b = base // h = height // a = area // Calculate area of the triangle $a = (float)(($b * $h) / 2); // Output echo "\nArea of the triangle = " . $a . " sq. units"; ?>
Area of the triangle = 17.5 sq. units