diff --git a/.idea/misc.xml b/.idea/misc.xml index d15472f..045943f 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/src/ArchimedesPiMethod.java b/src/ArchimedesPiMethod.java index 0b6e780..52c06fe 100644 --- a/src/ArchimedesPiMethod.java +++ b/src/ArchimedesPiMethod.java @@ -2,6 +2,14 @@ public class ArchimedesPiMethod { public static void main(String[] args) { - + System.out.println("Insert number of sides"); + Scanner sc= new Scanner (System.in); +int n = sc.nextInt(); +double b = 360.0 / n; +double a = (1.0 / 2.0 * b); +double s = 2.0 * Math.sin(Math.toRadians(a)); +double p = Math.PI * s; +double pi = p / 2.0; +System.out.println("PI =" + pi); } }