var a, b, c, r : integer;beginc:=0;r:=9;write('Введите число: ');readln(a);while a div 10 <> 0 dobeginb:=a mod 10;a:=a div 10;if b>c then c:=b;if b<r then r:=b;end;b:=a mod 10;a:=a div 10;if b>c then c:=b;if b<r then r:=b;writeln('Разность: ', c-r);end.ДА ХОТЬ ДЛЯ 10 ЗНАЧНОГО))))