viết chương trình đọc từ bàn phím dãy số thực có n phần tử (1 { "@context": "https://schema.org", "@type": "QAPage", "mainEntity": { "@type": "Question", "name": " viết chương trình đọc từ bàn phím dãy số thực có n phần tử (10 then d1:=d1+1; if A[i]<0 then d2:=d2+1; end; writeln(" t=",T:2:2); writeln(" co="" ',d1,'="" duong');="" write('co="" ',d2,'="" am');="" readln="" end.",="" 12:23:14="" "url":="" "https:="" mtrend.vn="" viet-chuong-trinh-doc-tu-ban-phim-day-so-thuc-co-n-phan-tu-1-n-100-hay-tinh-tong-cua-day-so-va-d-559="" #comment-1251119",="" "author":="" "person",="" "url"="" :="" author="" minhthue",="" "name":="" "minhthue"="" }="" },{="" bai_giai;="" a:array[1..100]="" n,i,da,dd:byte;="" t:real;="" n:="" da:="0;" dd:="0;" thu="" ',i,':="" readln(a[i]);="" if="" a[i]>0="" then="" else="" a[i]<0="" end;="" writeln('tong="" cac="" tu="" la:="" ',t:0:3);="" writeln('co="" ',dd,'="" ',da,'="" readln;="" 12:22:39="" #comment-1251120",="" thuminh",="" "thuminh"="" ]="" <="" script="">
program bai_giai;
uses crt;
var A:array[1..100] of real;
n,i,da,dd:byte;
t:real;
begin
clrscr;
write(‘Nhap n: ‘); readln(n);
t:=0; da:=0; dd:=0;
for i:=1 to n do
begin
write(‘Nhap so thu ‘,i,’: ‘); readln(A[i]);
t:=t+A[i];
if A[i]>0 then dd:=dd+1
else if A[i]<0 then da:=da+1;
end;
writeln(‘Tong cac phan tu la: ‘,t:0:3);
writeln(‘Co ‘,dd,’ so duong’);
writeln(‘Co ‘,da,’ so am’);
readln;
end.
program mang;
uses crt;
var A:array [1..100] of real;
n,i,d1,d1: integer;
T: real;
Begin
clrscr;
write(‘Nhap so phan tu: ‘); readln(n);
for i:=1 to n do
begin
write(‘A[‘,i,’]=’); readln(A[i]);
T:=T+A[i];
if A[i]>0 then d1:=d1+1;
if A[i]<0 then d2:=d2+1;
end;
writeln(‘T = ‘,T:2:2);
writeln(‘Co ‘,d1,’ so duong’);
write(‘Co ‘,d2,’ so am’);
readln
End.