In this post we will write a program using simple If Else statement which will take any number between 0 to 999 and will print if the number entered is a One/Two/Three digit number.
Let’s write the program. I am using Google Colab to write and execute this program. You can use any Editor to write program as per your choice.
num = int(input("Enter any number between 0 to 999 : "))
if num < 0:
print("Please enter any number in range 0-999")
elif num < 10:
print("One digit number entered.")
elif num < 100:
print("Two digit number entered")
elif num <= 999:
print("Three digit number entered")
else:
print("Invalid number entered")
Output:
I hope this program is easy for you. If you have any questions please post in comments section.
Happy Blogging!