liang183 发表于 2016-12-24 15:44:13

java编程题五边形的面积解题答案

package nameyu;import java.util.Scanner;public class Test {    /**   * @param args   */    public static void main(String[] args) {      // TODO Auto-generated method stub      Scanner input=new Scanner(System.in);      System.out.print("Enter the lenght from the center to a vertex:");      double r=input.nextDouble();      double s=2*r*Math.sin(Math.PI/5);      double area=(5*Math.pow(s, 2))/(4*Math.tan(Math.PI/5));      System.out.printf("The area of the pentagon is%4.2f ",area);    }    }   
页: [1]
查看完整版本: java编程题五边形的面积解题答案