Check Prime Number in Java

Check Prime Number in Java

Here you will learn and get the program code to Check Prime Number in Java programming.

A prime number is a natural number greater than 1 that has no positive divisors other than 1 and itself.

Example to Check Prime Number in Java

Output

C:\CodeRevise\java>javac PrimeCheck.java

C:\CodeRevise\java>java PrimeCheck
Enter a number: 12
12 is not a prime number.

C:\CodeRevise\java>java PrimeCheck
Enter a number: 7
7 is a prime number.

 

 

Check out our other Java Programming Examples

 

 

 

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top