Sunday, 11 December 2016

To find the reverse of number

#To find the reverse of number

#to accept the number from user
n=int(input('enter number:'))

#to store reverse of number
rev=0

#using while loop to find reverse of number
while(n!=0):
    r=n%10
    n=n//10
    rev=rev*10+r
   

#To display reverse of number
print('the reverse of number :',rev)


OUTPUT:





No comments:

Post a Comment