const n=10;
var i:integer;
a:array[1..n] of integer;
begin
for i:=1 to n do
a[i]:=random(10)+1;
write(a[i]:2,' ');
if i mod 2 = 0 then a[i]:=a[i]*2
else a[i]:=a[i]*3
end;
writeln;
for i:=1 to n do write(a[i]:2,' ')
end.
var a := ArrRandom(10, 1, 10); a.Println;
for var i := 0 to a.High do
if i.isOdd then a[i] *= 2
else a[i] *= 3;
a.Println;
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
const n=10;
var i:integer;
a:array[1..n] of integer;
begin
for i:=1 to n do
begin
a[i]:=random(10)+1;
write(a[i]:2,' ');
if i mod 2 = 0 then a[i]:=a[i]*2
else a[i]:=a[i]*3
end;
writeln;
for i:=1 to n do write(a[i]:2,' ')
end.
begin
var a := ArrRandom(10, 1, 10); a.Println;
for var i := 0 to a.High do
if i.isOdd then a[i] *= 2
else a[i] *= 3;
a.Println;
end.