Answers for "area of equilateral triangle java program"

1

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();
   }
}
Posted by: Guest on October-30-2020
0

area of equilateral triangle java

import java.util.Scanner;

public class Main {

    public static void main(String[] args) {

        // area of equilateral triangle

        Scanner scanner = new Scanner(System.in);

        System.out.print("Enter the equal length: ");
        float equalLength = scanner.nextFloat();

        double area = (Math.sqrt(3) / 4) * Math.pow(equalLength,2);

        System.out.printf("The area is %.2f",area);
    }
}
Posted by: Guest on June-27-2021

Code answers related to "area of equilateral triangle java program"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language