2.program bai_tap; type mang = array[1..1000] of integer; var a:mang; i,j,n:integer; begin writeln(‘nhap n:’); readln(n); i:=1;j:=0; while i <= n do begin write(‘nhap so thu ‘,i,’: ‘); readln(a[i]); if a[i] mod 2 = 0 then j:=j+a[i]; inc(i); end; write(j); readln end.
program tinh_tong;
uses crt;
var i,t:integer;
begin
clrscr;
t:=0; i:=1;
while i<=10 do
begin
t:=t+i;
i:=i+1;
end;
write(‘Tong cac so nguyen tu 1 den 10 la: ‘,t);
readln;
end.
1.Program tinhtong;
var: i,s:=longint;
Begin
i:=-1;
While i<n do
Begin
i:=i+2;
S:=S+i;
End;
readln;
End.
2.program bai_tap;
type mang = array[1..1000] of integer;
var a:mang;
i,j,n:integer;
begin
writeln(‘nhap n:’);
readln(n);
i:=1;j:=0;
while i <= n do
begin
write(‘nhap so thu ‘,i,’: ‘);
readln(a[i]);
if a[i] mod 2 = 0 then j:=j+a[i];
inc(i);
end;
write(j);
readln
end.