//Pascal ABC.NET v3.1 сборка 1219
Const
n=15;
Var
ar:array[1..n] of integer;
sum,i:integer;
begin
randomize;
writeln('First array:');
for i:=1 to n do
begin
ar[i]:=random(2,23);
write(ar[i]:4);
sum:=sum+sqr(ar[i]);
end;
writeln;
writeln('Sum=',sum);
writeln('Final array:');
for i:=1 to n do
begin
ar[i]:=ar[i]+ar[n];
write(ar[i]:4);
end;
end.
Пример работы программы:
First array:
19 21 10 13 7 13 9 2 22 20 10 7 17 7 22
Sum=3229
Final array:
41 43 32 35 29 35 31 24 44 42 32 29 39 29 44