Procedure swap(var a, b: real); var t: real; begin t := a; a := b; b := t; end;
var a, b, c: real; begin readln(a, b, c); if (a > b) then swap(a, b); if (b > c) then swap(b, c); if (a > b) then swap(a, b); writeln(a, ' ', b, ' ', c); end.
Без процедур:
var a, b, c, t: integer; begin readln(a, b, c); if (a > b) then begin t := a; a := b; b := t; end; if (b > c) then begin t := b; b := c; c := t; end; if (a > b) then begin t := a; a := b; b := t; end; writeln(a, ' ', b, ' ', c); end.
var t: real;
begin
t := a;
a := b;
b := t;
end;
var a, b, c: real;
begin
readln(a, b, c);
if (a > b) then swap(a, b);
if (b > c) then swap(b, c);
if (a > b) then swap(a, b);
writeln(a, ' ', b, ' ', c);
end.
Без процедур:
var a, b, c, t: integer;
begin
readln(a, b, c);
if (a > b) then
begin
t := a;
a := b;
b := t;
end;
if (b > c) then
begin
t := b;
b := c;
c := t;
end;
if (a > b) then
begin
t := a;
a := b;
b := t;
end;
writeln(a, ' ', b, ' ', c);
end.