area of equilateral triangle formula in java code example
Example: area of equilateral triangle in java
import java.util.Scanner;
public class AreaOfEquilateral
{
public static void main(String[] args)
{
Scanner sc = new Scanner(System.in);
System.out.println("Please enter the side of equilateral triangle: ");
double side = sc.nextDouble();
double area = (Math.sqrt(3)/4) * (side * side);
System.out.println("Area of equilateral triangle is: " + area);
sc.close();
}
}