uses crt; var i,n,d:integer; a:array[0..200] of integer; BEGIN clrscr; write(‘Nhap n:’); readln(n); for i:=1 to n do begin write(‘Nhap a[‘,i,’]’); readln(a[i]); end; d:=0; for i:=1 to n do if a[i]>0 then inc(d) else if a[i]<0 then dec(d); if d>0 then write(‘So luong so duong > so luong so am.’) else if d<0 then write(‘So luong so duong < so luong so am.’) else write(‘So luong so duong = so luong so am.’); readln END.
program sosanh;
uses crt;
var A:array[1..10000] of integer;
n,i,da,dd:integer;
begin
clrscr;
write(‘Nhap so luong phan tu cua day’); readln(n);
writeln(‘NHAP GIA TRI TUNG PHAN TU CUA DAY’);
da:=0; dd:=0;
for i:=1 to n do
begin
write(‘GIa tri cua phan tu thu ‘,i,’: ‘);
readln(A[i]);
if A[i]<0 then da:=da+1;
if A[i]>0 then dd:=dd+1;
end;
if da>dd then write(‘So luong nguyen am lon hon so luong nguyen duong’)
else if da<dd then write(‘So luong nguyen duong lon hon so luong nguyen am)
else write(‘So luong nguyen am bang so luong nguyen duong’);
readln
end.
uses crt;
var i,n,d:integer;
a:array[0..200] of integer;
BEGIN
clrscr;
write(‘Nhap n:’); readln(n);
for i:=1 to n do
begin
write(‘Nhap a[‘,i,’]’);
readln(a[i]);
end;
d:=0;
for i:=1 to n do
if a[i]>0 then inc(d)
else if a[i]<0 then dec(d);
if d>0 then write(‘So luong so duong > so luong so am.’)
else if d<0 then write(‘So luong so duong < so luong so am.’)
else write(‘So luong so duong = so luong so am.’);
readln
END.
Chúc bạn học tốt.
Cho mình xin ctlhn.