Subj : Re: Reversing a number To : comp.programming From : deanfamily11 Date : Sun Sep 11 2005 06:23 am I am able to get the last digit out and put it into another integer, but I can't get it to continue doing it (i.e. input = 12345, final result = 1). I have tried multiplying the result by 10, but i get get 10 * the number. "Alf P. Steinbach" wrote in message news:4323ae19.7955343@news.individual.net... >* 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? .