Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program deb;
- uses crt;
- const n=100;
- var a: array[1..n] of integer;
- b, i,j:integer;
- cont : boolean = true;
- begin
- randomize;
- writeln ('new masiv');
- for i:=1 to n do
- begin
- a[i]:=Random(100);
- write(a[i], ' ');
- end;
- writeln;
- while cont do
- begin
- cont := false;
- for j:=1 to n-1 do
- if a[j] > a[j+1] then
- begin
- b := a[j];
- a[j]:= a[j+1];
- a[j+1]:=b;
- cont := true;
- (*
- write(' swap,' ,a[j] ,'<>' ,a[j+1]);
- writeln();
- *)
- end;
- end;
- writeln('sort masiv');
- for i:=1 to n do
- write(a[i], ' ');
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement