write a programme in Java to print the area of equilateral triangle
Answers
Answered by
1
Explanation:
/**
* Java program to find area of an equilateral triangle
*/
import java.util.Scanner;
class Test
{
public static void main(String args[])
{
double side, area;
Scanner op=new Scanner(System.in);
/* Input side of equilateral triangle */
System.out.print("Enter side of an equilateral triangle: ");
side=op.nextDouble();
/* Calculate area of equilateral triangle */
area = (Math.sqrt(3) / 4) * (side * side);
/* Print resultant area */
System.out.println("Area of equilateral triangle = "+area+" sq. units");
}
}
Similar questions