Advertisement
AlexeySychev

Untitled

Apr 27th, 2020
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.36 KB | None | 0 0
  1. program ZADACHA1;
  2. var
  3. a : array [1..20] of integer;
  4. j,i,t,n: integer;
  5. BEGIN
  6. randomize;
  7. for i:=1 to 20 do
  8.   begin
  9.     a[i]:=random(20);
  10.   end;
  11. writeln(a);
  12. for j:=1 to 19 do
  13.   for i:=j+1 to 20 do
  14.     if (a[j] mod 2=0) and (a[i] mod 2=0) and (a[j] > a[i]) then
  15.       begin
  16.         t:=a[j];
  17.         a[j]:=a[i];
  18.         a[i]:=t;
  19.       end;
  20. writeln(a);
  21. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement