Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program Proste_wstawianie_rosnace;
- {$APPTYPE CONSOLE}
- uses
- SysUtils;
- const nMax=100;
- var a:array[1..nMax] of integer;
- n,i,j:integer;
- procedure ProsteWybieranie;
- var i,min,pom:integer;
- begin
- for i:=1 to n-1 do
- begin
- min:=i;pom:=a[i];
- for j:=i+1 to n do
- if a[j]<pom then begin min:=j; pom:=a[j]; end;
- a[min]:=a[i];a[i]:=pom;
- end
- end;
- begin
- randomize;
- write('podaj n, n<=',nMax, ' ');
- readln(n);
- for i:=1 to n do
- a[i]:=random(nMax);
- writeln ('wylosowane liczby to: ');
- for i:=1 to n do
- write(' ',2*a[i]+1);
- writeln;
- writeln;
- ProsteWybieranie;
- writeln ('posortowane liczby to: ');
- for i:=1 to n do
- write(' ',2*a[i]+1);
- writeln;
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement