> Just a minor enahnement to problem..What changes are to be> made to print 5 digit palindromes numbers in ascending> order?

I think the easy answer is, instead of calling System.out.println, make each number a new entry into a string array, hash table, or some such collection, sort the collection, then print that. This will also be easily adaptable for when you next ask "what about printing them in descending order?". You could also slap together a random number generator that spans the indices of the array and print them out in random order, too. Or start in the middle then print them in some funky inside out manner.

It's been a long, long time since I wrote any Java at all, so I'll have to kindly leave the implementation up to somebody more knowledgeable in the language. I'm just assuming you can somewhat easily do the above.

I'm sure there is a much more efficient method, but after 3 seconds of thought, that's one option.

I'm sure Mr. Gerrans can come up with a much more robust and flexible solution ;-) Poor guy comes up with a fancy robust solution and get ripped for it. Life is hard, sometimes.

> You should understand> that people asking such questions are beginners (most> probably high school students) and they are just> interested in submitting their assignments on time.

I think everyone knows that all these people want is to have someone else do their homework for them (which they will then present as their own work).

> Try to help these students if you can.

Why? Such students are dishonest. In asking for the answer on a plate, they are trying to cheat. In artificially boosting their own grades, they may even be having a detrimental effect on the grades of honest students.

Presenting a fully worked out solution:a) condones such behaviour,b) places honest students at a disadvantage.

It is well established in coding forums that if you really want to help student with their homework then you ask them what precisely is stooping them and then present them with enough information to help themselves.

(For what it's worth, since the damage has been done, here's (one way) I might have done it.)

Yeah, I tend to agree. There are plenty of places online where students can go online and "get hints" for their homework problems. At the very least we should force these students to be just a wee bit more subtle than, "Here's an interesting problem!"--oh, he fooled us there, but this is the killer--"Please email me the solution."

I also agree with many who say that this isn't an interesting problem. It really isn't. But it could be made a little more interesting by, say, posing this problem from USACO that was similar:

Generate all PRIME palindromes from 2 to 100,000,000.

Not very difficult, but it certainly raises the stakes over the previous ...

Hey, I have another interesting problem! Try paying all my bills on my income! If you come up with any money, please mail it to me.