DIM a(10)
INPUT "vvedite chislo ", n
DO
k = k + 1
a(k) = n MOD 10
n = n \ 10
LOOP UNTIL n = 0
max = a(1)
FOR i = 1 TO k
IF a(i) > max THEN max = a(i)
NEXT
FOR i = 1 TO k
IF a(i) = max THEN m = m + 1
NEXT
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
PRINT "maximalnaya cifra="; max; " ona vstrechaetsya"; m; "raz"
FOR i = 1 TO k
n = n * 10 + a(i)
NEXT
PRINT "minimalnoe chislo="; n
Тестирование выполнено в программе QB64 ( Скачать )