Const n=15; var a:array[1..n] of integer; s,i:integer; p:real; begin Randomize; writeln('Массив A:'); for i:=1 to n do begin a[i]:=random(16); write(a[i]:3); end; writeln; s:=0; p:=1; for i:=1 to n do begin s:=s+a[i]; p:=p*a[i]; end; writeln('s = ',s,' p = ',p); end.
var a:array[1..n] of integer;
s,i:integer; p:real;
begin
Randomize;
writeln('Массив A:');
for i:=1 to n do
begin
a[i]:=random(16);
write(a[i]:3);
end;
writeln;
s:=0; p:=1;
for i:=1 to n do
begin
s:=s+a[i]; p:=p*a[i];
end;
writeln('s = ',s,' p = ',p);
end.
Пример:
Массив A:
1 14 12 14 6 4 10 3 3 1 15 4 4 5 6
s = 102 p = 36578304000