Program BTT; Uses crt; Var A: array[1..500] of longint; n,i,d,s: longint; Begin Clrscr; Write(‘Nhap n: ‘); Readln(n); d:=0; s:=0; For i:=1 to n do Begin Write(‘A[‘,i,’] = ‘); Readln(A[i]); If A[i] mod 2 = 0 then s:=s+A[i] Else inc(d); End;
Writeln(‘Tong so chan: ‘,s); Write(‘Co ‘,d,’ so le’); Readln End.
đây bạn
Program BTT;
Uses crt;
Var A: array[1..500] of longint;
n,i,d,s: longint;
Begin
Clrscr;
Write(‘Nhap n: ‘); Readln(n);
d:=0; s:=0;
For i:=1 to n do
Begin
Write(‘A[‘,i,’] = ‘); Readln(A[i]);
If A[i] mod 2 = 0 then s:=s+A[i]
Else inc(d);
End;
Writeln(‘Tong so chan: ‘,s);
Write(‘Co ‘,d,’ so le’);
Readln
End.