uses crt; var i,n,d : integer; a : array[1..100] of integer; begin clrscr; d:=0; write(‘Nhap n:’); readln(n); for i:=1 to n do begin write(‘Nhap a[‘,i,’]=’); readln(a[i]); end; for i:=1 to n do if (a[i] mod 2=0) and (a[i] mod 3=0) then d:=d+1; write(‘Co ‘,d,’ so vua chia het 2 va 3 ‘); readln end.
Chưa hiểu ý bạn lắm, ý bạn là hiển thị có bao nhiêu số chia hết cho hai và chia hết cho ba phải honk
nếu đúng thì như sau nha
Bài làm
program Bai1;
var
n, i, d: integer ;
A: array [1..1000] of integer;
begin
write(‘ nhap so n:’);
read(n);
for i: = 1 to n do:
begin
writeln(‘so han thu A[‘,i,’]=’);
read(A[i]);
end;
for i:=1 to n do if A[i]mod2=0 and A[i]mod3=0 then inc(d); write(‘co ‘,d ‘ vua chia het cho 2 vua chia het cho 3’);
readln
end.
CHÚC BẠN HỌC TỐT!!
uses crt;
var i,n,d : integer;
a : array[1..100] of integer;
begin clrscr; d:=0;
write(‘Nhap n:’); readln(n);
for i:=1 to n do begin
write(‘Nhap a[‘,i,’]=’); readln(a[i]); end;
for i:=1 to n do if (a[i] mod 2=0) and (a[i] mod 3=0) then d:=d+1;
write(‘Co ‘,d,’ so vua chia het 2 va 3 ‘);
readln
end.