-----b1:
program baitap1;
uses crt;
var s:string[150];
i,count:integer;
begin
clrscr;
write('Nhap mang: ');readln(s);
writeln('Mang vua nhap la: ');
writeln;
count:=0;
for i:=1 to Length(s) do
if s[i]='A' then count:=count+1;
write('Ki tu A xuat hien : ',count,' lan. ');
readln;
end.
-----bt2
program baitap2;
uses crt;
var a:array[1..170] of integer;
i,tong,tich,n:integer;
begin
clrscr;
write('Nhap so phan tu: ');readln(n);
if (n<0) then begin
writeln('So nhap vao khong thoa man.');
write('Moi nhap lai: ');readln(n);
end;
tong:=0;
tich:=1;
for i:=1 to n do
if (a[i]>0) then
if (a[i] mod 3 ) = 0 then tong:=tong+a[i];
for i:=1 to n do
if (a[i] mod 2) <> 0 then tich:=tich*a[i];
writeln;
writeln('Cau a: ',tong);
writeln('Cau b: ,tich);
writeln('Mang nhap vao: ');
for i:=1 to n do
write(a[i],' ');
readln;
end.
// Nếu chạy sai chương trình thì ib -.-