Problem statement:
how do you reverse the given number?
how do you reverse the given number?
- class A {
- public static void main(String args[]) {
- int n = 243589;
- int r = 0;
- while (n != 0) {
- r = r * 10 + n % 10;
- n = n / 10;
- }
- System.out.println(r);
- }
- }
Output:
985342
Asked in - Synechron technologies
No comments:
Post a Comment