# Prime number series in python with algorithm

Prime number series in python with algorithm

Q):Implement python script to generate prime number series up to n

Aim: To generate prime number series up to n

Algorithm:
step 1: Start
step2: Declare lower variable and read
step 3: Declare higher variable and read.
step 4: In n for loop take the range of value from lower to higher .
step 5 : Check for the condition n > 1
step 6: If the condition is true go to the i for loop otherwise take the next iteration
step 7: In i for loop check the condition n % i = 0
step 8: if the condition is true then break the loop otherwise print that n value
step 9: end.

Source code:

lower = int(input(“enter lower range:”))
```higher = int(input("enter higher range:"))
for num in range(lower,higher + 1):
# prime numbers are greater than 1 ```
```  if num > 1:
for i in range(2,num):
if (num % i) == 0:
break     ```
```        else:
print(num)```
` `
` `
`Output:`
```enter lower range:0
enter higher range:50
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47

Process finished with exit code 0
```

prime number series in python with algorithm