Commit a88e59b
committed
feat: Count the number of digits in a given number
🧠 Logic:
- Take integer input `n`.
- Initialize counter `count = 0`.
- Use a `while` loop to repeatedly divide `n` by 10.
- Each division removes the last digit.
- Increment `count` on each iteration.
- When `n` becomes 0, `count` holds the total number of digits.
Signed-off-by: Somesh diwan <[email protected]>1 parent 9bc05e9 commit a88e59b
1 file changed
+1
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
13 | 12 | | |
14 | 13 | | |
15 | 14 | | |
| |||
0 commit comments