Program HOC24;
var i,n: integer;
a: array[1..32000] of integer;
t: longint;
begin
write('Nhap N: '); readln(n);
t:=0;
for i:=1 to n do
begin
write('a[',i,']='); readln(a[i]);
if a[i] mod 3=0 then t:=t+a[i];
end;
write('Tong cac phan tu chia het cho 3 la: ',t);
readln
end.
Đúng 2
Bình luận (0)
uses crt;
var a:array[1..100]of integer;
n,i,t:integer;
begin
clrscr;
write('Nhap n='); 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 3=0 then t:=t+a[i];
writeln(t);
readln;
end.
Đúng 0
Bình luận (0)