package
javaprgms;
public class
Reversenum {
public static void main(String[] args) {
int rev=0;
int num=1234;
while(num>0){
int rem=num%10;
rev=rem+(rev*10);
num=num/10;
}
System.out.println("Reverse
Number" + rev);
}
}
Output:
Reverse Number 4321
Thanks for This Code for Reverse a number Program in Java It's helpful for write any reverse number program in Java.
ReplyDelete