uses crt; var n,i,s:longint; a:array[1..10000000]of longint; begin clrscr; write(‘Nhap so n: ‘);readln(n); for i:=1 to n do begin write(‘Nhap phan tu thu ‘,i,’: ‘);read(a[i]); if a[i] mod 2=0 then inc(s,a[i]); end; writeln(‘Tong cac phan tu co gia tri chan: ‘,s); readln end.
Program …;
Uses crt;
Var A: array[1..100] of byte;
s,N,i: byte;
Begin
CLRSCR
Write(‘ Nhap so phan tu : ‘);
Reason(N);
For i:=1 to N do
Reason(A[i]);
s:=0;
For i:= 1 to N do
If(A[i] mod 2)=0 then
s:=s+A[i];
Write(‘Ket qua : ‘,s);
Readln;
End.
uses crt;
var n,i,s:longint; a:array[1..10000000]of longint;
begin
clrscr;
write(‘Nhap so n: ‘);readln(n);
for i:=1 to n do
begin
write(‘Nhap phan tu thu ‘,i,’: ‘);read(a[i]);
if a[i] mod 2=0 then inc(s,a[i]);
end;
writeln(‘Tong cac phan tu co gia tri chan: ‘,s);
readln
end.