We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8b29c6c commit 355d4c1Copy full SHA for 355d4c1
Misc/root_precision
@@ -0,0 +1,28 @@
1
+import java.io.*;
2
+import java.util.*;
3
+import java.text.*;
4
+import java.math.*;
5
+import java.util.regex.*;
6
+
7
+public class Solution {
8
9
+ public static void main(String[] args) {
10
+ Scanner scn = new Scanner(System.in);
11
12
+ int N = scn.nextInt();
13
+ int P = scn.nextInt();
14
15
+ System.out.println(squareRoot(N, P));
16
+ }
17
18
+ public static double squareRoot(int N, int P) {
19
+ double sqrt = 0;;
20
21
+ // Write your code here
22
+ double root = Math.pow(N, 0.5);
23
+ int pre = (int) Math.pow(10, P);
24
+ root = root * pre;
25
+ sqrt = (int)root;
26
+ return (double)sqrt/pre;
27
28
+}
0 commit comments