# Java Program to check the square root of a number is prime or not

In this program, You will learn how to check the square root of a number is prime or not in java.

`Some list of prime numbers is : 2, 3, 5, 7, 11`

## Example: How to check the square root of a number is prime or not in java.

```
import java.util.Scanner;
class Main {
public static void main(String args[]) {
int n, i, j, p = 1, z;
Scanner sc = new Scanner(System.in);
System.out.print("Enter a number:");
n = sc.nextInt();
System.out.println("Square root is:" + Math.sqrt(n));
z = (int) Math.sqrt(n);
for (i = 2; i < z; i++) {
if (z % i == 0) {
p = 0;
break;
}
}
if (p == 1){
System.out.println("Numbers is prime:" + z);
}else{
System.out.println("Numbers is not prime:" + z);
}
}
}
```

#### Output:

```
Enter a number:49
Square root is:7.0
Numbers is prime:7
```