Computer Science, asked by dram1759, 11 months ago

Algorithm and flowchart to find the given number is prime or not

Answers

Answered by BavanaLand
18

I have pinned the answer

Attachments:
Answered by Anonymous
5

Algorithm:

Step 1: Start

Step 2: Declare the variables n,i,flag.

            n for number

            i for counter

            flag to keep a check  

Step 3: Initialize the  variables

       flag= 1    and i=2  

Step 4: Input the number 'n' from user.

Step 5: Repeat the steps till i<(n/2)

    Part 1 : If remainder of n/i equals 0

            Set flag=0

           Go to step 6 , else

   Part 2 : i=i+1

Step 6: If flag=0

          Display: the number is not prime

       else

          Display: the number is prime

Step 7: Stop

Similar questions