de xem trong day co bao nhieu so am,bao nhieu so duong(biet so am la so<0,duong la so>0 18/07/2021 Bởi Audrey de xem trong day co bao nhieu so am,bao nhieu so duong(biet so am la so<0,duong la so>0
program am_duong; uses crt; var A:array[1..1000] of integer; n,i,da,dd:integer; begin clrscr; write(‘Nhap so luong: ‘); readln(n); da:=0; dd:=0; for i:=1 to n do begin write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]); if A[i]<0 then da:=da+1; if A[i]>0 then dd:=dd+1; end; write(‘Co ‘,da,’ so am va co ‘,dd,’ so duong’); readln; end. Bình luận
program am_duong;
uses crt;
var A:array[1..1000] of integer;
n,i,da,dd:integer;
begin
clrscr;
write(‘Nhap so luong: ‘); readln(n);
da:=0; dd:=0;
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]);
if A[i]<0 then da:=da+1;
if A[i]>0 then dd:=dd+1;
end;
write(‘Co ‘,da,’ so am va co ‘,dd,’ so duong’);
readln;
end.