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 side:"); double s=input.nextDouble(); double area=(6*Math.pow(s, 2))/(4*Math.tan(Math.PI/6)); System.out.printf("The area of the pentagon is%4.2f ",area); } }
页:
[1]