You are here: Home / Topics / Java Program to find area of equilateral triangle

Java Program to find area of equilateral triangle

Filed under: Java on 2024-03-05 21:43:15

import java.util.Scanner;
class AreaOfEquilateralTriangle 
{
  public static void main(String args[]) 
   {   
      
         Scanner s = new Scanner(System.in);
         System.out.println("Enter the side of the Equilateral Triangle:");
         double a= s.nextDouble();
         double  area=(Math.sqrt(3)/4)*(a*a);
         System.out.println("Area of Equilateral Triangle is: " + area);      
    }
}

Output:

Enter the side of the Equilateral Triangle:

5

Area of Equilateral Triangle is:  10.825317


About Author:
M
Mr. Dubey     View Profile
Founder of MCQ Buddy. I just like to help others. This portal helps students in getting study material free. Share your stuff here so that others can get benefitted.