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

Recommended Posts:


Prem Tiwari

An engineer by profession and a passionate blogger by heart. Founder of FreeWebMentor.com (A Programming blog for beginners), Tech Speaker at various forums. A part from this he is an open source enthusiast, WordPress Lover, Blogger, SEO, and Growth Strategic.


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

Leave a Reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.