import java.util.Scanner;
import java.lang.Math;
public class HomeWork {
public static void main(String[] args) {
double area;
double s;
Scanner input = new Scanner(System.in);
System.out.print("Enter the length from the center to a vertex:");
double r = input.nextDouble();
s=2*r*Math.sin(Math.PI/5);
area=(5*Math.pow(s,2))/(4*Math.tan(Math.PI/5));
System.out.printf("The area of the pentagon is %.2f",area);
input.close();
}
}
编写程序,提示用户输入从五边形中心到顶点的距离,计算五边形的面积(java))
最新推荐文章于 2022-07-29 19:57:52 发布