Bài 1:
uses crt;
var a:array[1..300]of integer;
n,i,t:integer;
begin
clrscr;
write('Nhap so phan tu:'); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do
if (a[i] mod 2<>0) and (i mod 2=0) then t:=t+a[i];
writeln('Tong cac phan tu le o vi tri chan la: ',t);
readln;
end.
Bài 2:
uses crt;
var a,b:integer;
{---------------------chuong-trinh-con--------------------------}
function tong(var x,y:integer):integer;
begin
tong:=x+y;
end;
{-------------------chuong-trinh-chinh----------------------}
begin
clrscr;
write('Nhap so thu nhat:'); readln(a);
write('Nhap so thu hai:'); readln(a);
writeln('Tong cua hai so la: ',tong(a,b));
readln;
end.