Java program to check whether the given number is prime or not

Java program to check whether the given number is prime or not

 In this post let’s how to find the given number by the user is prime or not. Usually prime number is a number which is divisible by one and by itself.

 Algorithm:

 1)Start
 2)Input the number from the user.
 3)Go on dividing the number starting from 2 to one unit lesser than the given number.
 4)Check whether remainder of any number is zero.
 5)If the remainder is not zero continue the loop.
 6)If the remainder is zero display the given number is not prime.
 7)When the loop gets over display that the given number is prime.


Code goes here:

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.

Advertisment ad adsense adlogger