//5.36
import java.util.Scanner;
//import java.text.Area;
public class Area {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.println("please input a n polygon and the length of the polygon");
int n = input.nextInt();//多边形的边数
double s = input.nextDouble();// 多边形的边长
System.out.println("the area of your polygon is " + Area(n, s));
}
public static double Area(int n, double s)
{
return ((n * s * s) / (4 * Math.tan(Math.PI / n)));
}
}
Java 5.36课后题多边形的面积
最新推荐文章于 2024-05-16 20:54:32 发布