Natural number
Natural numbers are numbers that are common and clearly in nature. As such, it is a whole, nonnegative number.
Logic
To print the first N natural number we only have to run one single loop from 1 to N.
After taking input (num) from user start one loop from 1 to num, and then inside the loop simply print the current variable “i”.
See also: Calculate sum of first N natural numbers
Program
# Take number from user num = int(input("Enter any number : ")) print("\nNatural numbers from 1 to", num) for i in range(1, num + 1): print(i, end=" ")
Output
Enter any number : 10
Natural numbers from 1 to 10
1 2 3 4 5 6 7 8 9 10