Question: What is the process of getting this answer. The answer is 917328 but I don't understand how to work it out. What value does mystery(918273)

What is the process of getting this answer. The answer is 917328 but I don't understand how to work it out.

What value does mystery(918273) return?

public static String mystery(int x)

{

String s = "";

for (int k = x; k > 0; k = k / 10)

{

if (k % 2 == 0) s = s + k % 10;

else s = k % 10 + s;

}

return s;

}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!