Hãy luôn nhớ cảm ơn và vote 5*
nếu câu trả lời hữu ích nhé!
Uses crt;
Var a:array[1..100] of integer;
i, n, dc, dl, tc: integer;
Begin
Clrscr;
Write('Nhap n = '); readln(n);
For i:=1 to n do
Begin
Write('A[',i,']=');
Readln(A[i]);
End;
dl:=0; dc:=0; tc:=0;
For i:=1 to n do if a[i] mod 2 = 0 then inc(dc);
For i:=1 to n do if a[i] mod 2 = 1 then inc(dl);
For i:=1 to n do if a[i] mod 2 = 0 then inc(tc, a[i]);
Writeln('Co ',dc,' so chan');
Writeln('Co ',dl,' so le');
Writeln('Tong cac so chan la: ',tc:4:2);
Readln
End.
Hãy giúp mọi người biết câu trả lời này thế nào?
2377
1794
uses crt;
var i,n,c,l,t:longint; a:Array[1..10000]of longint;
begin
clrscr;
write('n=');readln(n);
for i:=1 to n do
begin
write('a[',i,']=');readln(A[i]);
if a[i] mod 2=0 then begin inc(c); inc(t,a[i]) end else inc(l);
end;
writeln('So luong so chan: ',c);
writeln('So luong so le: ',l);
writeln('Tong so chan: ',t);
readln
end.
Hãy giúp mọi người biết câu trả lời này thế nào?
Bảng tin