uses crt; var i,n,tong:integer; a:array[0..100] of integer; BEGIN clrscr; write(‘Nhap N:’); readln(n); for i:=1 to n do begin write(‘Nhap a[‘,i,’]’); readln(a[i]); end; tong:=0; for i:=1 to n do if a[i] mod 6=0 then tong:=tong+a[i]; write(‘Tong cac so chan chia het cho 6 la:’,tong); readln END.
program chiahetcho3;
uses crt;
var n,i,t:integer;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
t:=0;
for i:=1 to n do
if i mod 3=0 then
begin
write(i,’ ‘);
t:=t+i;
end;
writeln;
write(‘Tong cua chung la: ‘,t);
readln
end.
uses crt;
var i,n,tong:integer;
a:array[0..100] of integer;
BEGIN
clrscr;
write(‘Nhap N:’); readln(n);
for i:=1 to n do
begin
write(‘Nhap a[‘,i,’]’);
readln(a[i]);
end;
tong:=0;
for i:=1 to n do
if a[i] mod 6=0 then
tong:=tong+a[i];
write(‘Tong cac so chan chia het cho 6 la:’,tong);
readln
END.