[ create a new paste ] login | about

Link: http://codepad.org/k1Ncw43j    [ raw code | output | fork ]

Ruby, pasted on Dec 10:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# num = gets.to_i # to get the user input
num = 702
res = ''
abc = ('A'..'Z').to_a
while num > 26 do 
  res += abc[num%26-1]
    if num%26==0 && num/26 >1
      num = num/26 - 1
    else
      num = num/26
    end
end
res += abc[num%26-1]
print res.reverse


Output:
1
ZZ


Create a new paste based on this one


Comments: