Отсортируйте 15 РАНДОМНЫХ чисел:
1) По возрастанию;
2) По убыванию.
program rost;
var n,i,j,x,imax:integer;
a:array[1..10] of integer;
begin
for i:=1to 10do read(a[i]);
for i:=1to 10 do write(a[i], ' ' );
for i:=1to 9do
begin
imin:=i;
for j:=i+1 to 10 do if a[j]>a[imax] then imax:=j;
x:=a[i];
a[i]:=a[imax];
a[imax]:=x
end;
for i:=1to 10do write (a[i], ' ' );
end.​
Please enter comments
Please enter your name.
Please enter the correct email address.
You must agree before submitting.

Answers & Comments


Copyright © 2024 SCHOLAR.TIPS - All rights reserved.