Reverse a Number Problem Statement

Given an integer 'N', write a program to generate the reverse of the number and print the resulting reversed number.

The reversed number should not include any leading zeros that may appear.

Example:

Input:
N = 10400
Output:
401
Explanation:

The reverse of 10400 is 00401, but leading zeros are omitted, resulting in 401.

Input:

Integer N

Output:

Corresponding reverse number

Constraints:

  • 0 <= N < 10^8
Anonymous
5mo
def reverse_number(N): reversed_str = str(N)[::-1] reversed_number = int(reversed_str) return reversed_number N = int(input("Enter an integer: ")) print(reverse_number(N))
Help your peers!
Add answer anonymously...
Deloitte Analyst Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter