In [6]:
num = int (input ('Enter a number: '))
reverse = 0
while num != 0:
r = num % 10
reverse = (reverse * 10) + r
num = int (num / 10)
print ('Reverse of the given number is: ', reverse)
Enter a number: 123456 Reverse of the given number is: 654321
No comments:
Post a Comment