Subj : Re: Reversing a number To : comp.programming From : Rob Thorpe Date : Tue Sep 13 2005 03:42 pm Gerry Quinn wrote: > In article <4326BFE2.2775@mindspring.com>, pfiland@mindspring.com > says... > > Rob Thorpe wrote: > > > Willem wrote: > > > > Roger wrote: > > > > ) "Irrwahn Grausewitz" wrote in message > > > > #include > > #include > > > > int revdecimal(int number); > > void itoa_r(int n, char *s); > > Depends on the language. E.g. Blitz Basic 3D: > > Function GetReverse( x ) > a$ = x > For i = Len( a$ ) To 1 Step -1 > b$ = b$ + Mid$( a$, i, 1 ) > Next > return b$ > End Function > > (This language can automatically cast between integers and their > decimal string representations.) In lisp dialects it's even simpler, in Common Lisp for example: (read-from-string (reverse (write-to-string a))) It's fairly simple in C though. .