Bài 1:
Program HOC24;
var a: array[1..100] of integer;
i,n,d: integer;
begin
write('Nhap so phan tu cua day : '); readln(n);
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
end;
d:=0;
for i:=1 to n do
if a[i] mod 3<>0 then inc(d);
write('Co ',d,' phan tu khong chia het cho 3 trong mang');
readln
end.
Bài 2:
Program HOC24;
var a: array[1..250] of integer;
i,n: integer;
t: longint;
begin
write('Nhap so phan tu cua day : '); 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] 0 then t:=t+a[i];
write('Tong cac phan tu khong am trong mang nguyen la ',t);
readln
end.
program bt1;
uses crt;
var a:array[1..100] of integer;
i,n,t: byte;
begin
clrscr;
writeln(' nhap so luong cac phan tu '); readln(n);
for i:=1 to n do
begin
writeln(' nhap gia tri tung phan tu: [',i,']');
readln(a[i]);
end;
t:=0;
for i:=1 to n do if i mod 3 <>0 then t:=t+1;
writeln(' so phan tu khong chia het cho 3 la: ',t);
readln;
end.
program bt2;
uses crt;
var a:array[1..250] of integer;
i,n: byte;
tong: real;
begin
clrscr;
writeln(' nhap so luong cac phan tu '); readln(n);
for i:=1 to n do
begin
writeln(' nhap gia tri tung phan tu: [',i,']');
readln(a[i]);
end;
tong:=0
for i:=1 to n do if (a[i] > 0) then tong:=tong+a[i];
writeln(' tong cac phan tu khong am la: ',tong:0:0);
readln;
end.