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); } }
|