Write a java program to Number Reverse?


package com.java2study;

public class NumberReverse {
public static void reverseNum(int number){
int reminder;
int reverse = 0;
int palindrome = number;
while(number>0){
reminder = number%10;
number = number/10;
reverse = (reverse*10)+reminder;
}
System.out.println("The Reversed Number is"+reverse);

}
public static void main(String[] args) {

NumberReverse.reverseNum(1432);

}

}

OutPut


The Reversed Number is 234



No comments:

Post a Comment