procedure qSort(var ar:array[low..high]of real; low,high:integer); var i,j:integer; m,wsp:real; begin i:=low; j:=high; m:=ar[(i+j) div 2]; repeat while(ar[i]<m) do i:=i+1; while(ar[j]>m) do j:=j-1; if(i<=j) then begin wsp:=ar[i]; ar[i]:=ar[j]; ar[j]:=wsp; i:=i+1; j:=j-1; end; until (i > j); if(low<j) then qSort(ar,low,j); if(i<high) then qSort(ar,i,high); end;
var ar:array[low..high]of real; i:integer; begin randomize;
for i:=low to high do ar[i]:=random(101)-50; qSort(ar,low,high); writeln; for i:=low to high do write(ar[i],' '); end.
Первая
var n,x:integer;
begin
readln(n);
while n <> 0 do begin
x:=x + n mod 10;
n:=n div 10;
end;
if(x mod 2 = 0) then
writeln('true')
else
writeln('false');
end.
Вторая
var x,z,s:integer;
begin
readln(x);
if (x > 99) and (x < 1000) then begin
s:=x;
while s<>0 do begin
z:=z+s mod 10;
s:=s div 10;
end;
if(x*x) = (z*z*z) then
writeln('true')
else
writeln('false');
end
else
writeln('Число должно быть 3-ех значным!');
end.
Третья
Var a,b,c:Real;
Begin
Writeln('Введите a');
Readln(a);
Writeln('Введите b');
Readln(b);
Writeln('Введите c');
Readln(c);
if (a=b) or (a=c) or (b=c) then
writeln ('true')
else
writeln ('false);
end.
const low=1; high=10;
procedure qSort(var ar:array[low..high]of real; low,high:integer);
var i,j:integer;
m,wsp:real;
begin
i:=low;
j:=high;
m:=ar[(i+j) div 2];
repeat
while(ar[i]<m) do i:=i+1;
while(ar[j]>m) do j:=j-1;
if(i<=j) then begin
wsp:=ar[i];
ar[i]:=ar[j];
ar[j]:=wsp;
i:=i+1;
j:=j-1;
end;
until (i > j);
if(low<j) then qSort(ar,low,j);
if(i<high) then qSort(ar,i,high);
end;
var ar:array[low..high]of real;
i:integer;
begin
randomize;
for i:=low to high do ar[i]:=random(101)-50;
qSort(ar,low,high);
writeln;
for i:=low to high do write(ar[i],' ');
end.