Всі умови | Умова: Дано дійсні числа a, b, c, d. Якщо a ≤ b ≤ c ≤ d, то кожне число замінити найбільшим з них; якщо a> b> c> d, то залишити без зміни; в іншому випадку всі числа замінюються їх квадратами.
(С.А. Абрамов, Г.Г. Гнездилова,Е.Н. Капустина, М.И. Селюн. Задачи по программированию. - Вологда, 2000. - №45)
program Pr45;
var
a, b, c, d : real;
max : real;
begin
readln(a, b, c, d);
if (a <= b) and (b <= c) and (c <= d) then
begin
max := a;
if (b > max) then max := b;
if (c > max) then max := c;
if (d > max) then max := d;
a := max;
b := max;
c := max;
d := max;
end
else if not ((a > b) and (b > c) and (c > d)) then
begin
a := sqr(a);
b := sqr(b);
c := sqr(c);
d := sqr(d);
end;
writeln(a : 5 : 2);
writeln(b : 5 : 2);
writeln(c : 5 : 2);
writeln(d : 5 : 2);
readln;
end.