Algorithm and Flowchart to find whether a number is Prime Number or Not

A number that is divisible by 1 and itself only is called a Prime Number. For Example, 3, 5, 7, 11, 13, 17 and 19 are examples of Prime Numbers. 2 is the only even prime number.

Algorithm and Flowchart for prime number

Algorithm:

  1. Start
  2. Read Number n
  3. Set the value of i=2 (Initialize variables)
  4.  If i<n then go to step 5  otherwise go to step 6
  5. If n%i ==0 then go to step 6
    • Else, Increment the value of I by 1 and go to step 4.
  6. If i==n then
    • Print “n is prime number”
    • Else
      • Print “n is not prime number”
  7. Stop

Flowchart:

Your Page Title
Please follow and like us:
error
fb-share-icon

Leave a Comment

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

Scroll to Top