diff --git a/DIRECTORY.md b/DIRECTORY.md index 656597c3b..30b107a17 100644 --- a/DIRECTORY.md +++ b/DIRECTORY.md @@ -439,7 +439,6 @@ * [RemoveDuplicateFromString](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/RemoveDuplicateFromString.java) * [ReturnSubsequence](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/ReturnSubsequence.java) * [ReverseStackUsingRecursion](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/ReverseStackUsingRecursion.java) - * [RootPrecision](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/RootPrecision.java) * [RotateMatrixBy90Degrees](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/RotateMatrixBy90Degrees.java) * [SieveOfEratosthenes](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/SieveOfEratosthenes.java) * [SkylineProblem](https://github.com/TheAlgorithms/Java/blob/master/src/main/java/com/thealgorithms/others/SkylineProblem.java) diff --git a/src/main/java/com/thealgorithms/others/RootPrecision.java b/src/main/java/com/thealgorithms/others/RootPrecision.java deleted file mode 100644 index bc195ffca..000000000 --- a/src/main/java/com/thealgorithms/others/RootPrecision.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.thealgorithms.others; - -import java.util.Scanner; - -public final class RootPrecision { - private RootPrecision() { - } - - public static void main(String[] args) { - // take input - Scanner scn = new Scanner(System.in); - - // n is the input number - int n = scn.nextInt(); - - // p is precision value for eg - p is 3 in 2.564 and 5 in 3.80870. - int p = scn.nextInt(); - System.out.println(squareRoot(n, p)); - - scn.close(); - } - - public static double squareRoot(int n, int p) { - // rv means return value - double rv; - - double root = Math.pow(n, 0.5); - - // calculate precision to power of 10 and then multiply it with root value. - int precision = (int) Math.pow(10, p); - root = root * precision; - /*typecast it into integer then divide by precision and again typecast into double - so as to have decimal points upto p precision */ - - rv = (int) root; - return rv / precision; - } -}