input "Please enter a number:" to x
a=0
b=9
x=alltrim(str(x))
k=len(x)
for i=1 to k
m=substr(x,i,1)<
n=int(val(m))
if n>a
a=n
endif
if n<b
b=n
endfor