Programming Examples

Python program to count the number of digits in given number


Write a python program to accept a integer number and count the number of digits in number.

Sample:

Input: 2223

Output: Number of Digits: 4

Solution

num=int(input("Enter any Number : "))
count=0
while num>0:
    count+=1
    num=num//10
print("Number of Digit : ",count)
▶ RUN

Output/ Explanation:

Enter any Number : 2342

Number of Digit :  4

Latest Current Affairs 2025 Online Exam Quiz for One day Exam Online Typing Test CCC Online Test Python Programming Tutorials Best Computer Training Institute in Prayagraj (Allahabad) Online MBA 2 years Online MCA Online BCA Best Website and Software Company in Allahabad