Skip to content

Commit b26f798

Browse files
Changes in code
1 parent 3fbeb84 commit b26f798

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

problems/reverse.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# Input number from the user
2+
N = int(input("Enter the number to be reversed "))
3+
4+
# Initiate value to null. R will store the value of the reverse of user input
5+
R = 0
6+
7+
# Check using while loop
8+
9+
while(N>0):
10+
#Logic
11+
remainder = N % 10
12+
R = (R * 10) + remainder
13+
N = N//10
14+
15+
# Print the output
16+
print("The reverse number is: {}".format(R))

0 commit comments

Comments
 (0)