0
$\begingroup$

In the question asked here, task is to convert decimal numbers to alphabets, like

1: A 2: B . . . 26: Z 27: AA . . . 703: AAA 

the method used to generate the alphabets is ::

1: subtract 1 from the number
2: calculate number % 26 where % is remainder operator and
if remainder is 0 print A, for 1 print B .... for 25 print Z.
3: divide the number by 26.
4: repeatedly perform steps 1 to 3, till the number becomes zero.

how this method is working? what is the logic behind this? please explain.

  • 0
    Do you know how to convert decimal numbers into binary ?2012-09-02
  • 0
    What exactly are you asking about? Why this representation is unique? How to come up with one like it? Something else? In general this is a bit like how decimal numbers work.2012-09-02
  • 0
    what is the need of the subtraction? In the second part of the [question](http://stackoverflow.com/q/12237361/981787) where 0 represents A, 1 represents B .... 26 represents AA, this solution is not working. why?2012-09-02
  • 0
    [Possibly relevant](http://math.stackexchange.com/questions/172808/).2012-09-02

2 Answers 2