Uses crt; procedure swap(a, b: integer); var t: integer; begin t := a; a := b; b := t; end;
procedure right(mas: array[1..100] of integer); var i: integer; begin for i:=100 downto 2 do swap(mas[i],mas[i-1]); end;
var mas : array[1..100] of integer; a, b, i : integer; begin readln(a, b); randomize(); for i:=1 to 100 do mas[i]:=a + random(b-a); right(mas); right(mas); right(mas); for i:=1 to 100 do writeln(mas[i]:5); end.
1 votes Thanks 1
sellsaccountvar a, b, i :integer; s :array [1..10000] of integer; begin readln (a, b); for i:=1 to b-a+1 do s[i]:=random(b-a+1)+a; for i:=b-a-1 to b-a+1 do write (s[i], ' '); for i:=1 to b-a-2 do write (s[i], ' ') end.
Answers & Comments
Verified answer
Uses crt;procedure swap(a, b: integer);
var t: integer;
begin
t := a;
a := b;
b := t;
end;
procedure right(mas: array[1..100] of integer);
var i: integer;
begin
for i:=100 downto 2 do
swap(mas[i],mas[i-1]);
end;
var mas : array[1..100] of integer;
a, b, i : integer;
begin
readln(a, b);
randomize();
for i:=1 to 100 do
mas[i]:=a + random(b-a);
right(mas);
right(mas);
right(mas);
for i:=1 to 100 do
writeln(mas[i]:5);
end.
s :array [1..10000] of integer;
begin
readln (a, b);
for i:=1 to b-a+1 do
s[i]:=random(b-a+1)+a;
for i:=b-a-1 to b-a+1 do write (s[i], ' ');
for i:=1 to b-a-2 do write (s[i], ' ')
end.