prime-or-not-java
This program takes input from user and checks if the number is prime or not.

Definition: A prime number is a natural number greater than 1 and which is only divisible by 1 and itself.

For example:

Enter the number: 17
17 is a prime number.

Enter the number: 21
21 is not a prime number.

Output

 

Java program to check whether a number is prime or not
Tagged on:

Leave a Reply

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