area of isosceles triangle in java

Let’s learn area of isosceles triangle in java.

area of isosceles triangle in java

An isosceles triangle is a triangle where its two sides and angles are equal.

To calculate area of isosceles triangle formula is:

area of isosceles triangle = [ B/4√((4 * a * a) – (b * b)) ]

Now let’s see java program.

import java.util.Scanner;
public class AreaOfIsoscelesTriangle
{
   public static void main(String[] args)
   {
      Scanner sc = new Scanner(System.in);
      System.out.println("Please enter length of same sided: ");
      double a = sc.nextDouble();
      System.out.println("Please enter side2 of isosceles triangle: ");
      double b = sc.nextDouble();
      double area = (b/4) * Math.sqrt((4 * a * a) - (b * b));
      System.out.println("Area of isosceles triangle is: " + area);
      sc.close();
   }
}


Output:

Please enter length of same sided:
6
Please enter side2 of isosceles triangle:
9
Area of isosceles triangle is: 17.858821349685986


Also read – area of equilateral triangle in java

Also read – area of circle in java