1
citeste n
citeste x
max<-x, min<-x
pentru i<-2, n executa
citeste x
daca x>max atunci max<-x
daca x<min atunci min<-x
scrie (max+min)/2
2
citeste n
max<- -1
min<-10
repeta
daca n%10>max atunci max<-n%10
daca n%10<min atunci min<-n%10
n<-[n/10];
pana cand n=0
n<-max*10+min
scrie n