Var ar,ar2:array[1..10] of integer; i:integer; begin randomize; writeln('First array:'); for i:=1 to 10 do begin; ar[i]:=random(10)-3; write(ar[i]:4); if ar[i]=0 then ar2[i]:=0; end; writeln; writeln('1-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]<0 then ar2[i]:=ar[i]; end; writeln; writeln('2-st Final array:'); for i:=1 to 10 do begin; write(ar2[i]:4); if ar[i]>0 then ar2[i]:=ar[i]; end; writeln; writeln('3-st Final array:'); for i:=1 to 10 do write(ar2[i]:4); end.
ar,ar2:array[1..10] of integer;
i:integer;
begin
randomize;
writeln('First array:');
for i:=1 to 10 do
begin;
ar[i]:=random(10)-3;
write(ar[i]:4);
if ar[i]=0 then ar2[i]:=0;
end;
writeln;
writeln('1-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]<0 then ar2[i]:=ar[i];
end;
writeln;
writeln('2-st Final array:');
for i:=1 to 10 do
begin;
write(ar2[i]:4);
if ar[i]>0 then ar2[i]:=ar[i];
end;
writeln;
writeln('3-st Final array:');
for i:=1 to 10 do
write(ar2[i]:4);
end.
begin
var x:=-2.0;
while x<=2 do begin
Writeln('x=',x:4:1,' y=',x*x*x+12:6:3);
x+=0.2
end
end.
Результат выполнения программы:
x=-2.0 y= 4.000
x=-1.8 y= 6.168
x=-1.6 y= 7.904
x=-1.4 y= 9.256
x=-1.2 y=10.272
x=-1.0 y=11.000
x=-0.8 y=11.488
x=-0.6 y=11.784
x=-0.4 y=11.936
x=-0.2 y=11.992
x= 0.0 y=12.000
x= 0.2 y=12.008
x= 0.4 y=12.064
x= 0.6 y=12.216
x= 0.8 y=12.512
x= 1.0 y=13.000
x= 1.2 y=13.728
x= 1.4 y=14.744
x= 1.6 y=16.096
x= 1.8 y=17.832
x= 2.0 y=20.000