问题:六边形面积
编写程序 提示用户输入六边形的边长,然后显示其面积。
import java.util.Scanner;
public class Hexagon {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("Enter the length of the side:");
double s = input.nextDouble();
double area = ((3*Math.sqrt(3))/2)*s*s;
System.out.println("The area of the hexagon is " + area);
}
}