Write a program to reverse a number

This article will help you to understand “Java Program to reverse number”

We need to write a program to reverse a number using numeric operations. We can also reverse it using string operations as used in Palindrome Example

Java Program to reverse number

Output

Reversed Number : 987654321 Reversed Number : 21

Note:- Limitations of this program is, if the input has trailing zero like 12000 as an example, then reversed number will not consider this zero in leading position and as per numeric nature, leading zero will not be there in output.

To overcome this limitation, we can use String logic as Palindrome Example

It's good to share...Share on FacebookTweet about this on TwitterShare on LinkedInPin on PinterestShare on Google+Email this to someone

Leave a Reply

Your email address will not be published. Required fields are marked *