Program HOC24;
var a: array[1..1000] of integer;
i,n,d: integer;
tbc: real;
t: longint;
begin
write('Nhap N: '); readln(n);
for i:=1 to n do
begin
write('A[',i,']='); readln(a[i]);
end;
t:=0;
for i:=1 to n do t:=t+a[i];
writeln('Tong cac phan tu cua mang la: ',t);
d:=0;
for i:=1 to n do if a[i]=5 then d:=d+1;
writeln('Co ',d,' phan tu co gia tri bang 5');
tbc:=0;
for i:=1 to n do if a[i] mod 2=1 then tbc:=tbc+a[i];
tbc:=tbc/n;
writeln('Trung binh cong cac phan tu le la: ',tbc:6:2);
write('Mang sau khi thay la: ');
for i:=1 to n do if a[i]=0 then a[i]:=10;
for i:=1 to n do write(a[i],' ');
readln
end.
Đúng 0
Bình luận (0)