Prime Number Program in Java

Prime Number Program in Java | prime number program in java using for loop

Prime Number Program in Java: This is a simple Java program to find the prime number. A prime number is a number which is greater than 1 and only divisible by 1 or itself.

In the below example, we have shared the first 10 prime number which you can test using below Java program to confirm the Prime number program in Java programming language.

Prime Number Program in Java

In this program, I have taken number as variable to hold the number which will be checked whether it is a prime number or not.

Copy the below java program and execute it with the help of Java compiler to print the prime number program in java with the output for your better under standing the concept of prime number.

Output of Prime Number Program in Java

11 is prime number

If you like FreeWebMentor and you would like to contribute, you can write an article and mail your article to [email protected] Your article will appear on the FreeWebMentor main page and help other developers.

Recommended Posts:

Article Tags: , , , , , , , , ,