# Count the number of digits in a Number in Python

Write a program to count the number of digits of a given number.

Sample Input 1:

345

Sample Output 1:

3

Sample Input 2:

56

Sample Output 2:

2

#### Try your Solution

Strongly recommended to Solve it on your own, Don't directly go to the solution given below.

#write your code here

#### Program or Solution

```
```
n = int(input())count = 0while n > 0: n = n // 10 count = count + 1print(count)

#### Program Explanation

if we divide a number by 10, then last digit of the same number will removed and we get remaining digits as output. Do the same till number becomes 0 and count iteration. So the count is number of digits of the given number .

#### Comments

#### Related Programs

- Find given number is a digit in a number using Python
- Count the Number of Occurrences of digit in a number using Python
- Print the first Digit of a Number using Python
- Sum of Digits of the number using Python
- Product of Digits of the number using Python
- Reverse the digits of a number using Python
- Find a number is Armstrong number or not using Python

coming Soon

coming Soon