Commit 18dfb91
committed
feat: Display digits of a number in words
🧠 Logic:
- Accept integer input `n` and reverse it while storing digits in a string `str`.
- Reverse is necessary to retain original digit order for word conversion.
- Iterate through `str` in reverse (to get original order).
- Use a `switch` statement to map each character (digit) to its corresponding word and print it.
Signed-off-by: Somesh diwan <[email protected]>1 parent a88e59b commit 18dfb91
1 file changed
+6
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
15 | | - | |
| 14 | + | |
16 | 15 | | |
17 | 16 | | |
18 | 17 | | |
| |||
23 | 22 | | |
24 | 23 | | |
25 | 24 | | |
26 | | - | |
| 25 | + | |
| 26 | + | |
27 | 27 | | |
28 | | - | |
| 28 | + | |
| 29 | + | |
29 | 30 | | |
30 | 31 | | |
31 | 32 | | |
| |||
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
52 | | - | |
| 53 | + | |
0 commit comments