' Programma dlya perevoda tselikh chisel
' v raznie sistemi schisleniya
LITERAS$ = "0123456789ABCDEF"
Ishodn$ = "10" 'Chislo dlya perevoda
n& = 5 'Iskhodnaya SS
p& = 10 'Rezultiruyushchaya SS
A& = 0
PZ& = 0
Result$ = ""
CLS
PRINT Ishodn$; " (osnovanie"; n&; ")"
' Perevod v desyatichnuyu
DO: kb$ = INKEY$
IF Ishodn$ = "" THEN EXIT DO
MN& = INSTR(1, LITERAS$, RIGHT$(Ishodn$, 1)) - 1
Ishodn$ = LEFT$(Ishodn$, LEN(Ishodn$) - 1)
A& = A& + MN& * (n& ^ PZ&)
PZ& = PZ& + 1
LOOP UNTIL Ishodn$ = ""
' Perevod iz desyatichnoi sistemi v lyubuyu s osnovaniem do 16
DO: kb$ = INKEY$
O& = A& MOD p&
A& = A& / p&
Result$ = MID$(LITERAS$, O& + 1, 1) + Result$
LOOP UNTIL A& = 0
PRINT Result$; " (osnovanie"; p&; ")"
Тестирование выполнено в программе QB64 ( Скачать )