Commit ee029e7
committed
feat: Implement logic to reverse a given number using modulus and division
🧠 Logic:
- Extract digits from the number using `% 10`.
- Build the reversed number by multiplying `rev` by 10 and adding the digit.
- Repeat until the original number becomes 0.
- Print the reversed number at the end.
Signed-off-by: Somesh diwan <[email protected]>1 parent d65d4fa commit ee029e7
1 file changed
+1
-4
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
2 | | - | |
3 | 1 | | |
4 | 2 | | |
5 | 3 | | |
| |||
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
13 | | - | |
| 10 | + | |
14 | 11 | | |
15 | 12 | | |
16 | 13 | | |
| |||
0 commit comments