Question: The following algorithm checks and displays whether an inputted number is prime or not. STEP 1 : START STEP 2 : ENTER A POSITIVE INTEGER,

The following algorithm checks and displays whether an inputted number is prime or not.
STEP 1: START
STEP 2: ENTER A POSITIVE INTEGER, N
STEP 3: SET I =2 AND SET DIVS =0
STEP 4: IF I < N/2, GO TO STEP 5 ELSE GO TO STEP 7
STEP 5: IF I DIVIDES N THEN DIVS = DIVS +1
STEP 6: I = I +1 AND GO TO STEP 4
STEP 7: IF DIVS >0 THEN PRINT N IS COMPOSITE ELSE PRINT N IS PRIME
STEP 8: STOP
Convert the above algorithm into a flowchart, and test it using hand calculations for the numbers
11 and 35.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!