Write a program to count the number of digits.
Program:
c=0
n=int(input("Enter any no"))
while(n>0):
d=int(n%10)
c=c+1 #count number of digits
n=int(n/10) #convert into integer
print("Number of digits:",c)
In this Python Tutorial you can get update about the Python Programming language. You will know about scope of Python, Interview questions, all basic and advanced topics of Python.
Comments
Post a Comment
If you have any doubt, Please let me know..