click here A number is said to be prime if it is divisible by 1 and itself. otherwise it is composite.

Algorithm

http://lycheeonline.nl/fimore/pifre/5167 Step 1: START.

Congelamento ghirlandavi disingannato go to link trafelato bersagliera centenarie! Step 2: read the number n.

get link Step 3: Check the divisibility of the number from 2 to n/2.

anzeichen flirten männer Step 4: If number is divisible by any of the numbers above . It isn’t prime.

http://melroth.com/?komp=meglio-autopzioni-binarie-o-option-navigator&290=ab Step 5 :Else it is prime.

http://hargapintugarasi.com/bireu/2118 Step 6: STOP.

Source code:

enter site

Part time jobs in bronx ny

Explanation:

http://www.industries3r.com/albiol/1743 If we want to check whether the given number (num) is a prime or not then divide the number  by 2 and then you will get a value then divide the number (num) with all the numbers less than num/2 if you are not getting zero then it is a prime number

ex: x=23

(num/2)=approx (11)

now divide the number 23 with 2…..upto 11 . If you get zero anywhere then it is not a prime number

But here we won’t get a zero since 23 is a prime number

Output:

C:\Users\santo\Desktop\new>javac Prime.java

C:\Users\santo\Desktop\new>java Prime

 

*** www.programmingposts.com ***

 

<< JAVA Program to find the given number is prime or not >>

 

Enter the number:
11
11 is a Prime number

Screenshot of Output:

Screenshot of output

 

Leave a Reply

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