Originally Posted by

**Maxfmc**
...For example, the number 12345 will need to reduce in descending order 1234, 123, and so on.

Let me make sure I understand the assignment.

Suppose the number is 123456789. MIght a program run look like the following?

Enter an integer: 123456789

123456789

12345678

1234567

123456

12345

1234

123

12

1

Well, how would a program produce that sequence of numbers from the initial one?

I note that, using integers for the variables, according to the rules of integer arithmetic

123456789/10 = 12345678

Also

12345678/10 = 1234567

Etc.

Originally Posted by

**Maxfmc**
But I've been warned that if I include the number 0 to the number 12345 the program will not execute properly even though it will work.

What the heck does that mean? If it doesn't execute properly, how can anyone say that it "will work?" Either it works or it doesn't work. If it "works," then that means it executes properly, right? What am I missing here? (How about getting the person who warned you give an example for which he/she thinks that, "it will not execute properly even though it will work.")

Anyhow, my next question is: What does having a zero digit

*in* the number have to do with anything?

For example, suppose the number is 102030405. Then a run might look like the following:

Enter an integer: 102030405

102030405

10203040

1020304

102030

10203

1020

102

10

1

As before, I note that, using integer arithmetic on integer variables:

102030405/10 = 10203040

Also

10203040/10 = 1020304

Etc.

Now, if you had a "leading zero" the simplest kind of Java numerical print function might not show it, so a run could look like

Enter an integer: 012345

12345

1234

123

12

1

But so what? I mean, are you required to print the leading zero each time? Or is that program output OK? Or what? (I'll assume that output is OK unless you clarify the requirements to explain something more about it.)

Anyhow...

I don't know whether there is a "best way" to do anything, but if you had some kind of loop that prints out the value of the number and then divides by 10 each time through the loop, it could show output sequences like my examples. (Eventually you can figure that repeatedly dividing by 10 will result in a quotient whose value is zero. That's how you know when to terminate the loop.)

I'm not sure what the modulo operator has to do with anything in the context of my interpretation of the assignment.

But it's entirely possible that I missed something (again).

If I have misunderstood the assignment, maybe you can enlighten me.

Cheers!

Z