Var A,B:array[1..10000] of integer; i,j,M,N:integer; Begin Write('N = ');ReadLn(N); Write('Исходный массив: '); For i:= 1 to N do Begin A[i]:=random(10)+1; Write(A[i],' '); End; WriteLn; Write('Полученный массив: '); For i:= 1 to N-1 do Begin if A[i]>A[i+1] then M:=A[i] else M:=A[i+1]; j:=M-1; Repeat j:=j+1; Until (j mod A[i] = 0)and(j mod A[i+1] = 0); B[i]:=j; Write(B[i],' ') End; End.
//PascalABC.Net 3.2 function NOK(a, b: integer):integer; begin while a<>b do if a>b then a-=b else b-=a; result:=a; end;
begin var a:=ReadArrInteger('Вводите: ', readinteger('Размерность массива: ')); var b: array of integer; setLength(b, length(a)-1); for var i:=0 to length(a)-2 do b[i]:=(a[i]*a[i+1]) div NOK(a[i], a[i+1]); a.Println; b.Print; end.
A,B:array[1..10000] of integer;
i,j,M,N:integer;
Begin
Write('N = ');ReadLn(N);
Write('Исходный массив: ');
For i:= 1 to N do
Begin
A[i]:=random(10)+1;
Write(A[i],' ');
End;
WriteLn;
Write('Полученный массив: ');
For i:= 1 to N-1 do
Begin
if A[i]>A[i+1] then M:=A[i]
else M:=A[i+1];
j:=M-1;
Repeat
j:=j+1;
Until (j mod A[i] = 0)and(j mod A[i+1] = 0);
B[i]:=j;
Write(B[i],' ')
End;
End.
function NOK(a, b: integer):integer;
begin
while a<>b do
if a>b then a-=b else b-=a;
result:=a;
end;
begin
var a:=ReadArrInteger('Вводите: ', readinteger('Размерность массива: '));
var b: array of integer; setLength(b, length(a)-1);
for var i:=0 to length(a)-2 do b[i]:=(a[i]*a[i+1]) div NOK(a[i], a[i+1]);
a.Println;
b.Print;
end.