Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- je = {0=>'0',1=>'1',2=>'2',3=>'3',4=>'4',5=>'5',6=>'6',7=>'7',8=>'8',9=>'9',10=>'A'}
- sz = {0=>'0',1=>'1',2=>'2',3=>'3',4=>'4',5=>'5',6=>'6',7=>'7',8=>'8',9=>'9',10=>'A',11=>'B',12=>'C',13=>'D',14=>'E',15=>'F'}
- #wpisujesz se w pierwszej linijce liczbę ile liczb chcesz zamienic
- # a potem w każdej linijce liczbę którą chcesz zamienić
- #czyli na przykład
- #2
- #10
- #200
- gets.chomp.to_i.times do
- meh = gets.chomp.to_i
- liczba = meh
- cyfry = []
- until liczba == 0
- reszta = liczba % 16
- cyfry << reszta
- liczba = (liczba-reszta) / 16
- end
- for e in cyfry.reverse
- print sz[e]
- end
- print " "
- liczba = meh
- cyfry = []
- until liczba == 0
- reszta = liczba % 11
- cyfry << reszta
- liczba = (liczba-reszta) / 11
- end
- for e in cyfry.reverse
- print je[e]
- end
- print "\n"
- end
Advertisement
Add Comment
Please, Sign In to add comment