- Write a Java program to find the area of a Right Angled Triangle.
- What is the formulae to calculate area of triangle.

To calculate the area of a Right-angled triangle, first we need to understand some fundamental properties of a right angled triangle. Right triangle is a triangle in which one angle is a **right angle** (90 degree). The sum of the other two angles of **right-angled triangle** is 90 degree.

**Sides of Right Triangle**

**Base and Perpendicular**: The two adjacent sides of the right angle. These are the two sides of a triangle which are not hypotenuse.**Hypotenuse**: Hypotenuse is the longest side of a right angled triangle which is opposite the right angle.

**Area of Right angled Triangle**

Area of Right triangle, if we know the length of base and perpendicular.

- Area of Right Triangle = (1/2)* Base * Perpendicular

If we know the length of hypotenuse and altitude of a right triangle, then we can use below mentioned formula to find area of a right triangle.

- Area of Right Triangle = (1/2)* Hypotenuse * Altitude

## Java program to calculate area of right triangle

package com.tcc.java.programs; import java.util.*; class TriangleArea { public static void main(String args[]) { double base, height, area; Scanner in = new Scanner(System.in); System.out.println("Enter length of base of Triangle"); base = in.nextDouble(); System.out.println("Enter length if height of Triangle"); height = in.nextDouble(); // Area if Triangle = (Base X Height)/2; area = (base * height)/2; System.out.println("Area of Triangle = " + area); } }Output

Enter length of base of Triangle 3.0 Enter length if height of Triangle 4.0 Area of Triangle = 6.0

**Recommended Posts**