public class AreaCalculator {
public static void main(String[] args) {
//Taking inputs from the user
Scanner input=new Scanner(System.in);
System.out.println("Enter the number of sides");
int n = input.nextInt();
System.out.println("Enter the side");
double side = input.nextDouble();
calculateArea(n,side);
}
public static double calculateArea(int n, double side){
//Calculation for the finding area
double area = (n*side*side)/(4*(Math.tan(Math.PI/n)));
System.out.println("area is "+ area);
return area;
}
}
Hiç yorum yok:
Yorum Gönder