;

# Python Program to Print the Natural Numbers in a Given Range

###### Tutorialsrack 22/04/2020 Python

In this Python program, we will learn how to print the natural numbers in a given range.

Here is the code of the program to print the natural numbers in a given range.

### Using For Loop

##### Program 1: Python Program to Print Natural Numbers from 1 to Nth Using For Loop
``````# Python Program to Print Natural Numbers from 1 to Nth

# To Take input from the User
num = int(input("Enter any Number: "))

print("The List of Natural Numbers from 1 to {0} are".format(num))

for i in range(1, num + 1):
print (i, end = '  ')
``````
##### Output

Enter any Number: 10

The List of Natural Numbers from 1 to 10 are

1  2 3  4 5 6  7 8 9 10

### Using While Loop

##### Python Program to Print Natural Numbers from 1 to Nth Using While Loop
``````# Python Program to Print Natural Numbers from 1 to Nth

# To Take input from the User
num = int(input("Enter any Number: "))
i = 1

print("The List of Natural Numbers from 1 to {0} are".format(num))

while ( i <= num):
print (i, end = '  ')
i = i + 1
``````
##### Output

Enter any Number: 10

The List of Natural Numbers from 1 to 10 are

1  2 3  4 5 6  7 8 9 10

### Program 3: Python Program to Print the Natural Numbers within a Given Range

##### Python Program to Print the Natural Numbers within a Given Range
``````# Python Program to Print Natural Numbers within a given range

minNum = int(input("Enter the Minimum integer Value : "))
maxNum = int(input("Enter the Maximum integer Value : "))

print("The List of Natural Numbers from {0} to {1} are".format(minNum, maxNum))

for i in range(minNum, maxNum + 1):
print (i, end = '  ')
``````
##### Output

Enter the Minimum integer Value : 5

Enter the Maximum integer Value : 20

The List of Natural Numbers from 5 to 20 are

5  6 7  8 9 10  11 12 13  14 15 16 17  18 19 20