uses crt; var i:byte; tong:integer; a:array[1..5] of integer; BEGIN clrscr; tong:=0; for i:=1 to 5 do begin write('Nhap a[',i,']:'); readln(a[i]); if a[i] mod 2=1 then tong:=tong+a[i]; end; write('Tong cac so le trong mang A la:',tong); readln END.
program oken; uses crt; var a: array[1..5] of longint; s,i: longint; begin s:=0; for i:=1 to 5 do begin write('a[',i,']: '); readln(a[i]); end; for i:=1 to 5 do if (a[i] mod 2<>0) and (a[i]>=0) then s:=s+a[i]; write('Tong: ',s); readln; end.