uses crt; var n,i:integer;a:array[1..1000] of integer;tong,tich:longint; BEGIN clrscr; write(‘Nhap N: ‘);readln(n); for i:=1 to n do begin write(‘Nhap so thu ‘,i,’: ‘);readln(a[i]); end; tich:=1;tong:=0; for i:=1 to n do if a[i] mod 2 = 0 then begin tong:=tong+a[i]; tich:=tich*a[i] end; writeln(‘Tong cac so chan trong day la: ‘,tong); writeln(‘Tich cac so chan trong day la: ‘,tich); readln END.
program tinhtong;
var a:array[1..9999] of longint;
s,i,n : longint;
begin
writeln (‘nhap n’); readln (n);
for i:= 1 to n do
begin
writeln (‘nhap pt thu ‘ , i , ”);
readln (a[i]);
end;
s:=0;
for i:= 1 to n do
if a[i] mod 2 = 0 then s:= s+a[i];
writeln (‘tong cac so chan’,s);
readln
end;
NHỚ VOTE CHO MÌNH NHA
uses crt;
var n,i:integer;a:array[1..1000] of integer;tong,tich:longint;
BEGIN
clrscr;
write(‘Nhap N: ‘);readln(n);
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘);readln(a[i]);
end;
tich:=1;tong:=0;
for i:=1 to n do
if a[i] mod 2 = 0 then
begin
tong:=tong+a[i];
tich:=tich*a[i]
end;
writeln(‘Tong cac so chan trong day la: ‘,tong);
writeln(‘Tich cac so chan trong day la: ‘,tich);
readln
END.