INPUT "vvedite bolshee chislo ", b
INPUT "vvedite menshee chislo ", m
DIM a(10)
DO
k = k + 1
a(k) = m MOD 10
m = m \ 10
LOOP UNTIL m = 0
FOR i = 1 TO k
FOR j = 2 TO k
IF a(j) > a(j - 1) THEN SWAP a(j), a(j - 1)
NEXT
NEXT
FOR i = 1 TO k
m = m + a(i)
IF i <> k THEN m = m * 10
NEXT
IF m < b THEN PRINT "zadacha ne imeet resheniya" ELSE PRINT m; ">"; b
Тестирование выполнено в программе QB64 ( Скачать )