Count the Number of Digits in a Number in python

Share on facebook
Share on twitter
Share on pinterest

In this Basic Python Program, we will have a look at how to “count the number of digits in a number” with the help of Python Programming Language.

Python Program To Count Number Of Digits 

n=int(input("Enter number:"))

count=0

while(n>0):

    count=count+1

    n=n//10

print("The number of digits in the number are:",count)

In the above program, we counted the numbers of digits in a number.

 

Subscribe to our Newsletter

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut elit tellus, luctus nec ullamcorper mattis, pulvinar dapibus leo.

Share this post with your friends

Share on facebook
Share on google
Share on twitter
Share on linkedin

Leave a Reply

Your email address will not be published. Required fields are marked *