Previously we have discussed the Program for
Here we learn the program for Reversing the Numerical digits.
public class ReverseNumbers {
public static void reverse(int num){
int reverse = 0;
while(num != 0){
reverse = (reverse*10)+(num%10);
num = num/10;
}
System.out.println("REVERSE : "+reverse);
}
public static void main(String[] args) {
ReverseNumbers.reverse(123);
ReverseNumbers.reverse(1425);
}
}
Program Output:
REVERSE : 321
REVERSE : 5241
Blog Author - Pushkar Khosla,
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.
Software Developer by Profession with 3.0 Yrs of Experience , through this blog i'am sharing my industrial Java Knowledge to entire world. For any question or query any one can comment below or mail me at pushkar.itsitm52@gmail.com.
This blog is all about to learn Core Java ,Interview Programs and Coding tricks to polish your Java Knowledge. If you like the content of this blog please share this with your friends.


No comments:
Post a Comment