Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Scanner;
- public class squareRoot {
- public static void main(String[] args) {
- Scanner input = new Scanner(System.in);
- System.out.print("Enter your input: ");
- int n = input.nextInt();
- if (n < 0) {
- System.out.println("It's impossible to get square root of a negative number");
- return;
- }
- double output = Math.sqrt(n);
- System.out.print(output);
- }
- }
Add Comment
Please, Sign In to add comment