# Print Prime numbers up to N

This is a simple python program to print prime numbers up to n, where n is the limit.

A prime number (or a prime) is a natural number greater than 1 that has no positive divisors other than 1 and itself. The program asks the user to input the limit which is stored in the variable n, ie., the program prints prime number up to the number entered. By default the the starting prime number is set to 1, You can change this if you want to. Here we used range() function in the program.

### Program Sources

```# Python program to display all the prime numbers upto n

# Setting the intial value with 1
Starting_value = 1

# Taking input from the user
n  = int(input("Enter the number: "))

print("Prime numbers between", Starting_value, "and", n, "are:")
for num in range(Starting_value, n + 1):
if num > 1:
for i in range(2, num):
if (num % i) == 0:
break
else:
print(num)
```

### Program Output

```Enter the number: 20
Prime numbers between 1 and 20 are:
2
3
5
7
11
13
17
19

```