public class MathsSol {
public static void main(String args[]) {
int a = 4958;
reverseNumber(a);
}
public static void reverseNumber(int num) {
int remainder = 0;
while (num != 0) {
remainder = remainder * 10 + num % 10;
num = num / 10;
}
System.out.println(remainder);
}
}
Output:
8594
No comments:
Post a Comment