mirror of
https://github.com/TheAlgorithms/Java.git
synced 2025-07-14 01:16:07 +08:00
@ -1,8 +1,3 @@
|
||||
import java.lang.StringBuilder;
|
||||
import java.util.*;
|
||||
import java.util.Scanner;
|
||||
import javax.swing.*;
|
||||
|
||||
public class HexaDecimalToBinary {
|
||||
|
||||
private final int LONG_BITS = 8;
|
||||
|
@ -1,8 +1,4 @@
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.text.*;
|
||||
import java.math.*;
|
||||
import java.util.regex.*;
|
||||
import java.util.Scanner;
|
||||
|
||||
public class RootPrecision {
|
||||
|
||||
@ -10,14 +6,17 @@ public class RootPrecision {
|
||||
// take input
|
||||
Scanner scn = new Scanner(System.in);
|
||||
|
||||
int N = scn.nextInt(); //N is the input number
|
||||
int P = scn.nextInt(); //P is precision value for eg - P is 3 in 2.564 and 5 in 3.80870.
|
||||
// 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));
|
||||
}
|
||||
|
||||
public static double squareRoot(int N, int P) {
|
||||
double rv = 0; //rv means return value
|
||||
// rv means return value
|
||||
double rv;
|
||||
|
||||
double root = Math.pow(N, 0.5);
|
||||
|
||||
@ -28,6 +27,6 @@ public class RootPrecision {
|
||||
so as to have decimal points upto P precision */
|
||||
|
||||
rv = (int) root;
|
||||
return (double)rv/precision;
|
||||
return rv / precision;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user