Python Program to Print Natural Number

Write a Python Program to Print Natural Numbers using While Loop and For Loop with an example. 

See

the

Example 

See

the

OutPut

# Python Program to Print Natural Numbers from 1 to N number = int(input("Please Enter any Number: ")) print("The List of Natural Numbers from 1 to {0} are".format(number)) for i in range(1, number + 1):    print (i, end = '  ')

See

the

While loop 

Please Enter any Number: 10 The List of Natural Numbers from 1 to 10 are 1  2  3  4  5  6  7  8  9  10

Python Natural Numbers Program using While Loop

%

# Python Program to Print Natural Numbers from 1 to N number = int(input("Please Enter any Number: ")) i = 1 print("The List of Natural Numbers from 1 to {0} are".format(number)) while ( i <= number):    print (i, end = '  ')    i = i + 1

Laptop 3/4

Output

Please Enter any Number: 25 The List of Natural Numbers from 1 to 25 are 1  2  3  4  5  6  7  8  9  10  11  12  13  14  15  16  17  18  19  20  21  22  23  24  25