maxchislo = 2147483647
DIM b$(255)
DO
INPUT "vvedite naturalnoe chislo ", a$
FOR i = 1 TO LEN(a$)
k = k + 1
b$(k) = MID$(a$, i, 1)
IF b$(k) < "0" OR b$ > "9" THEN f = 1
NEXT
IF f = 0 AND VAL(a$) > maxchislo THEN f = 1
IF f = 1 THEN PRINT "Vvod neveren. Vvedite zanovo"
LOOP UNTIL f = 0
max$ = b$(1)
kol = 1
FOR i = 2 TO k
IF b$(i) = max$ THEN kol = kol + 1
IF b$(i) > max$ THEN max$ = b$(i): kol = 1
NEXT
PRINT "maximalnaya cifra="; max$
PRINT "ona vstretilas"; kol; "raz"
FOR i = 1 TO k
FOR j = 2 TO k
IF b$(j) < b$(j - 1) THEN SWAP b$(j), b$(j - 1)
NEXT
NEXT
FOR i = 1 TO k
c$ = c$ + b$(i)
NEXT
PRINT "minimalnoe chislo="; VAL(c$)
Тестирование выполнено в программе QB64 ( Скачать )