Subj : Re: Reversing a number To : comp.lang.c++,comp.programming From : alfps Date : Sun Sep 11 2005 05:13 am * deanfamily11: > I need to write a function that takes an integer as a parameter and then > returns it reversed (i.e. input: 45678, returned: 87654). Of course, that problem pops up in all kinds of everyday situations. > Can anyone help? Start by writing out the digits in right-to-left order, by using integer division in a loop. Example: 45678/10 = 4567 when "/" denotes integer division. And what do you get when you multiply the result by 10? Follow-up set to [comp.programming]. -- A: Because it messes up the order in which people normally read text. Q: Why is it such a bad thing? A: Top-posting. Q: What is the most annoying thing on usenet and in e-mail? .