मराठी

Write a program to find the reverse of that number.

Advertisements
Advertisements

प्रश्न

Write a program to find the reverse of that number.

कोड लेखन
Advertisements

उत्तर

Form the reverse by appending the last digit of the number at each step.

n = int(input("Enter any number: "))
reverse = 0

while n > 0:
    reverse = reverse * 10 + n % 10
    n //= 10

print("Reverse number is", reverse)
shaalaa.com
  या प्रश्नात किंवा उत्तरात काही त्रुटी आहे का?
पाठ 1: Review of Phython - EXERCISE [पृष्ठ २७]

APPEARS IN

सीबीएसई Computer Science with Python [English] Class 12
पाठ 1 Review of Phython
EXERCISE | Q 21. | पृष्ठ २७
Share
Notifications

Englishहिंदीमराठी


      Forgot password?
Use app×