Pseudocode And Flowchart for Generating 100 Prime Numbers


Prime numbers are one of the most basic concept of mathematics and are studied in a theory called number theory.

Primes are the numbers that can only be divided by 1 and and the number itself. For example, 11 is a prime number since I'm left with a remainder if I divide 11 by any number other than 11 or 1. 8 is not a prime because I can divide 8 by 2.

Flowchart For Generating 100 Prime Numbers

Pseudocode and Flowchart for generating 100 Prime Numbers
Remove WaterMark from Above Flowchart

Algorithm to generate 100 prime numbers

Step 1: Start Step 2: Declare Variable num, i, flag Step 3: Intialize num=1,count=0 Step 4: Repeat until count<=100 4.1: Initialize Variable i=1 and flag=0 4.2: Repeat Until i<=num 4.2.1 if(num%i==0), set flag=flag+1 4.2.2 increment i=i+1 4.3 If(flag<=2), Print num, set count=count+1 4.4 increment num=num+1 Step 7: Stop

In the above algorithm,

  1. We first define a variable num and initialize it to 1 and a variable count=0 and put it in a loop till it reaches 100.
  2. Then we initialize 2 variables flag to 0 and i to 1.
  3. We then check if num is divisible by i, which takes up value till it reaches num. If divisible we increment flag by 1. We repeat the above step until num is greater than or equal to i.
  4. Then, we check whether flag is equal to 2, if yes Print num and increment count by 1
  5. After that num increments by 1 and the above process continues till count reaches 100

Similar Articles:


1 comment
  • Abhishek Kumar

    Generation of prime number up to range 5 Input n=5 Output=2,3,5


For any inquiry, Contact us at

Facing Programming Errors. Get Answers within 24 hours:

Recommendation Based on your Interest

Quiz For You:
Online Games
Play 2048 Game Online and Relax.
Play 2048 Game Online

Search Tags

    Algorithm for 100 Prime Numbers

    Algorithm for Prime Numbers up to 100

    Flowchart for 100 Prime Numbers

    Flowchart for Prime Numbers up to 100

    Find 100 Prime Numbers