Area solver for shapes is just one of the exercises given by most programming instructors. Some other exercises are the following:
1. Celsius to Fahrenheit Temperature Converter
2. Identify if odd or even number
3. Display numbers using a for loop
4. Solve for the area of a triangle
5. Fibonacci Series
and many more. These are just some of the activities that I posted here in my blog. You can visit the links if you want.
So in this article, I created a simple program to solve for the area of a triangle using php. Let us define what is an area first. Area is the surface of an object like triangle, square, parallelogram, rhombus and many more shapes. The formula used to solve for the area of triangle is
A = Area of the triangle
h = height of the triangle
b = base of the triangle
A=hb/2 or height * base /2
Thank you for visiting and hope this helps you. Feel free to leave a comment below for any questions. I got some other articles related to php in blog
A = Area of the triangle
h = height of the triangle
b = base of the triangle
A=hb/2 or height * base /2
PHP Code area of triangle
<?php
$height=10;
$base=20;
$area=$height*$base/2;
echo $area;
?>
No comments:
Post a Comment