Javascript program to enter the two angles of a triangle and find the third angle
ADVERTISEMENTS
Javascript 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 javascript language.
Base Knowledge:
a° + b° + c° = 180°
Formula:
c° = 180° - (a° + b°)
Let us understand this example through Javascript program:
/* Javascript program to find all angles of a triangle if two angles are given */
<script type="text/javascript">
var p, q, r;
// p, q, and r is all angles of the triangle
p = 45;
q = 85;
// Compute third angle
r = 180 - (p + q);
document.write("Third angle of the triangle = " + r);
</script>
Output Screen:
Third angle of the triangle = 50