tong cac so am va 0 am
var
a:array[1..100] of integer;
s1,s2:real;
i,n:integer;
begin
write('nhap tong so cac phan tu n=');readln(n);
for i:=1 to ndo
begin
write('a[',i,']');readln(a[i]);
and;
s1:=0;
s2:=0;
for i:=1 to n do
if a[i]>=0 then s1:=s1+a[i]
else s2:=s2+a[i];
write('tong cac so khong am s1= ',s1:8:2);
write('tong cac so am s2= ',s2:8:2);
readln;
end.
Bạn đang đọc truyện trên: Truyen247.Pro