Java Program to find Area of a Isosceles Triangle

Write a Java Program to Find the Area of an Isosceles Triangle with an example. This Java example allows entering lengths of both sides of an Isosceles Triangle. The math formula for Isosceles triangle area is b * √(4a2 – b2)/4

package Area;

import java.util.Scanner;

public class AreaOfIsosceles1 {
	private static Scanner sc;

	public static void main(String[] args) {
		double a, b, isosArea; 
		sc = new Scanner(System.in);
		
		System.out.print("Enter Isosceles Triangle Side Length =  ");
		a = sc.nextDouble();
		
		System.out.print("Enter Isosceles Triangle Other Side  = ");
		b = sc.nextDouble();

		isosArea = (b * Math.sqrt((4 * a * a) - (b * b)))/4;

		System.out.format("The Area of a Isosceles Triangle = %.3f",isosArea);
	}
}
Enter Isosceles Triangle Side Length =  17
Enter Isosceles Triangle Other Side  = 19
The Area of a Isosceles Triangle = 133.930

In this Java program, we declared an IsoscelesArea function that returns the Isosceles Triangle area.

package Area;

import java.util.Scanner;

public class AreaOfIsosceles2 {
	private static Scanner sc;

	public static void main(String[] args) {
		double a, b, isosArea; 
		sc = new Scanner(System.in);
		
		System.out.print("Enter Isosceles Triangle Side Length =  ");
		a = sc.nextDouble();
		
		System.out.print("Enter Isosceles Triangle Other Side  = ");
		b = sc.nextDouble();

		isosArea = IsoscelesArea(a, b);

		System.out.format("The Area of a Isosceles Triangle = %.3f",isosArea);
	}
	
	public static double IsoscelesArea(double a, double b) {
		return (b * Math.sqrt((4 * a * a) - (b * b)))/4;
	}
}
Java Program to find Area of a Isosceles Triangle 1