Uses crt; const n=20; var p:array[1..n] of integer; s:array[1..n] of integer; i,j:integer; begin randomize; for i:=1 to n do begin p[i]:=random(40)-20; write(p[i]:3); end; writeln; for i:=1 to n do if p[i]<0 then p[i]:=p[i]*p[i]; for j:=1 to n do for i:=1 to n do if i=j then s[j]:=p[i]; for j:=1 to n do write(s[j]:4); end.
Program task; var i,n:longint; a:array [0..10000] of real; s:array [0..10000] of real; begin writeln('skolko elementov v massive?'); readln(n); for i:=1 to n do begin a[i]:= -50 + random(100); end; for i:=1 to n do begin if (a[i]<0) then s[i]:=sqr(a[i]) else s[i]:=a[i]; end; for i:=1 to n do begin writeln(s[i]:0:0); end; readln; end.
const n=20;
var p:array[1..n] of integer;
s:array[1..n] of integer;
i,j:integer;
begin
randomize;
for i:=1 to n do
begin
p[i]:=random(40)-20;
write(p[i]:3);
end;
writeln;
for i:=1 to n do
if p[i]<0 then p[i]:=p[i]*p[i];
for j:=1 to n do
for i:=1 to n do
if i=j then s[j]:=p[i];
for j:=1 to n do
write(s[j]:4);
end.
var i,n:longint;
a:array [0..10000] of real;
s:array [0..10000] of real;
begin
writeln('skolko elementov v massive?');
readln(n);
for i:=1 to n do begin
a[i]:= -50 + random(100);
end;
for i:=1 to n do begin
if (a[i]<0) then s[i]:=sqr(a[i])
else s[i]:=a[i];
end;
for i:=1 to n do begin
writeln(s[i]:0:0);
end;
readln;
end.