Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.InputMismatchException;
- import java.util.Scanner;
- public class Sqrt {
- public static void main(String[] args) {
- try {
- Scanner scanner = new Scanner(System.in);
- int number = scanner.nextInt();
- double numberSqrt = Math.sqrt(number);
- System.out.printf("%.5f", numberSqrt);
- }
- catch (InputMismatchException e){
- System.out.println("Wrong input! Please next time enter number but not symbol.");
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement