Suppose the input is 2 3 4 5 0. What is the output of the following code?
public class Test {
public static void main(String[] args) {
System.out.println(xMethod(5672));
}
public static int xMethod(int number) {
int result = 0;
while (number != 0) {
int remainder = number % 10;
result = result * 10 + remainder;
number = number / 10;
}
return result;
}



Answer :

Other Questions