[r]
(1){Kiem tra day co doi xung khong} Program b4; Var n,i,dau,cuoi:longint; kt:boolean; a:array[1 100] of longint; Begin Write('N= '); Readln(n); For i:=1 to n BEgin Write('A[',i,']= '); Readln(a[i]); End; dau:=01; cuoi:=n; While ((a[dau]=a[cuoi]) and (dau<=cuoi)) Begin inc(dau); dec(cuoi); End; If dau>cuoi then writeln('Day doi xung') Else Writeln('Day khong doi xung'); Readln; End (2)