Viết chương trình nhập vào n số nguyên và n các số nguyên đó được nhận từ bàn phím đến xem trong n số đó được nhập vào có bao nhiêu số âm

2 câu trả lời

Program dem_so ;

Uses crt ;

Var A: array [1..150] of integer ;

       i,n,d : integer;

Begin

Write('nhap n=');

Readln (n);

For i:=1 to n do

Begin

Write ('nhap phan tu thu ',i,' =');

Readln (A[i]);

end;

d:=0;

For i:=1 to n do 

If A[i]<0  then 

d:=d+ 1;

Writeln('so so nguyen am trong day la:', d);

Readln

End.

uses crt;
var A:array[1..1000] of integer;
    i,n,dem:integer;
begin
   clrscr;
   write('Nhap n: '); readln(n);
   for i:=1 to n do
   begin 
      write('Nhap phan tu thu ',i,': ');
      readln(A[i]);
      if A[i]<=0 then inc(dem);
   end;
   write('Co ',dem,' so am');
   readln
end.