Java Program To

Reverse Number

http://freepdf-books.com

out.com . } System.in).out. reverse = 0. reverse = reverse + n%10. class ReverseNumber { public static void main(String args[]) { int n. Scanner in = new Scanner(System.This program prints reverse of a number i. n = n/10.nextInt().util.Scanner. http://freepdf-books.println("Enter the number to reverse"). System. while( n != 0 ) { reverse = reverse * 10.println("Reverse of entered number is "+reverse). n = in. } } Download Reverse number program class file. if the input is 951 then output will be 159.e. Java programming source code import java.

You can use this code to check if a number is palindrome or not.com . if the reverse of an integer is equal to integer then it's a palindrome number else not.Output of program: You can also reverse or invert a number using recursion. http://freepdf-books.