Program HOC24;
var a: array[1..32000] of integer;
i,n,tg,c,l: integer;
tc,tl: longint;
begin
write('Nhap N: '); readln(n);
c:=0; l:=0; tc:=0; tl:=0;
for i:=1 to n do
begin
write('Nhap so thu ',i,': '); readln(a[i];
if a[i] mod 2=0 then
begin
c:=c+1;
tc:=tc+a[i];
end;
if a[i] mod 2=1 then
begin
l:=l+1;
tl:=tl+a[i];
end;
end;
write('Day da sap xep: ');
for i:=1 to n do if a[i] mod 2=1 then write(a[i],' ');
for i:=1 to n do if a[i] mod 2=0 then write(a[i],' ');
writeln;
wirteln('Co ',l,' so le');
writeln('Co ',c,' so chan');
writeln('Tong cac so le la: ',tl);
writeln('Tong cac so chan la:', tc);
readln
end.
Đúng 0
Bình luận (0)