Program Zamena; Const n=10; Var a: array [1..n] of integer; i,k: integer; Begin Randomize; For i:=1 to n DO a [i] := Random(10); Write ('Введенный массив'); For i:=1 to n DO Writeln (a[i]:4); Readln (a[i]); For i:=1 to n DO Begin k:= a[i] mod 2; If a[i] / 2 = k then a[i] := a[i] * 2 else a[i] := Sqr(a[i]); End; Write ('Новый массив'); For i:=1 to n DO Writeln (a[i]:4); Readln (a[i]); End.
Const n=10;
Var
a: array [1..n] of integer;
i,k: integer;
Begin
Randomize;
For i:=1 to n DO
a [i] := Random(10);
Write ('Введенный массив');
For i:=1 to n DO
Writeln (a[i]:4); Readln (a[i]);
For i:=1 to n DO
Begin
k:= a[i] mod 2;
If a[i] / 2 = k then a[i] := a[i] * 2 else a[i] := Sqr(a[i]);
End;
Write ('Новый массив');
For i:=1 to n DO
Writeln (a[i]:4); Readln (a[i]);
End.