Program HOC24;
var n: word;
t,min,max: byte;
begin
write('Nhap N= '); readln(n);
min:=n mod 10;
max:=n mod 10;
while n<>0 do
begin
t:=n mod 10;
if min>t then min:=t;
if max<t then max:=t;
n:=n div 10;
end;
writeln('Chu so nho nhat la: ',min);
write('Chu so lon nhat la: ',max);
readln
end.
var n: word;
t,min,max: byte;
begin
write('Nhap N= '); readln(n);
min:=n mod 10;
max:=n mod 10;
while n<>0 do
begin
t:=n mod 10;
if min>t then min:=t;
if max<t then max:=t;
n:=n div 10;
end;
writeln('Chu so nho nhat la: ',min);
write('Chu so lon nhat la: ',max);
readln
end.