Last Updated: 16 July, 2022
In this tutorial, we are going to learn how to find the area of a triangle.
A triangle is a polygon with three edges and three vertices. It is one of the basic shapes in geometry. A triangle with vertices A, B, and C is denoted △ABC.
We can calculate the area of a triangle based on the below given formula.
Area of Triangle=(width * height) / 2;
Let's see how to write a Java program and use this formula.
Output
Width of Triangle: 21.75
Height of Triangle: 10.5
Area of Triangle: 114.1875
Output
Enter Triangle width: 30.5
Enter Triangle Height: 20.75
Area of Triangle: 316.4375
That's all guys, hope this Java Program is helpful for you.
Happy Learning... 😀
feedback@javabytechie.com