Python Program to Print Natural Numbers

Python Program to Print Natural Numbers

How to Print Natural Numbers from 1 to n by Python? In Python we can print n consecutive Natural Numbers by using Loops. Here in this program we used "while loop" to get our desired output.

Printing Natural Numbers by Python :



n = int(input('Please Enter any Number : '))

i = 1

print('The List of Natural Numbers from 1 to %d are : '%(n)) 

while ( i <= n ) :
    print (i)
    i = i + 1


Output :