Program to accept a number. Display the reverse of the number. Input: 123 Output: 321 r=0 n = int(input("Enter a number:")) while n>0: d=n%10 r=r*10+d n=n//10 print("Reverse of the number is",r) ''' Dry Run r=0 n=123 123>0,True, d=123%10=3, r=0*10+3=3, n=123//10=12 12>0,True, d=12%10=2, r=3*10+2=32, n=12//10=1 1>0,True, d=1%10=1, r=32*10+1=321, n=1//10=0 0>0,False Reverse of the number is 321 '''
All Solved Program and question papers for ICSE, ISC , CBSE and WBCHSE WB Board. Number 1 Programming & Coding classes in West Bengal.