PHP program to enter the two angles of a triangle and find the third angle
ADVERTISEMENTS
PHP program to enter the two angles of a triangle and find the third angle. There are you will learn how to find the third angle of a triangle in PHP language.
Base Knowledge:
a° + b° + c° = 180°
Formula:
c° = 180° - (a° + b°)
Let us understand this example through the PHP program:
<?php
// PHP program to find all angles of a triangle if two angles are given
$p = 50;
$q = 70;
$r = NULL;
// p, q, and r is all angles of the triangle
// Compute third angle
$r = 180 - ($p + $q);
// Output
echo "Third angle of the triangle = " . $r;
?>
Output:
Third angle of the triangle = 60