Write a java program to find area of a triangle

We know the area of a triangle can be obtained by the formula 0.5 X base X height. Means half of the product of its height and base. The below program demonstrated how to find area of a triangle using java program for beginners.

If you want to learn Java from Beginning please Click Here.

public class Project3{
public static void main(String args[])
{
float base=5f;
float height=10f;
float area = 0.5f*base*height;
System.out.println(“Area of triangle =”+area);
}
}

My Self Subrat Dash. I have completed my MSc in Information Technology. Since last 12 years i am teaching Math and Computer at TTRC Computer Institute situated at Rayagada, Odisha, India. I believe in conceptual learning, so i explain each and every concept with demos and examples, which makes it easier to understand.

    1 Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.

error: Content is protected !!