
Cora
4 год назад
Дано 4 числа. Найти наибольшие и наименьшее число с помощью if/else.
ОТВЕТЫ

Нина
Nov 21, 2020
var a, b, c, d, min, max: integer;
begin
// Min
readln(a, b, c, d);
if (a <= b) and (a <= c) and (a <= d) then min := a
else if (b <= a) and (b <= c) and (b <= d) then min := b
else if (c <= a) and (c <= b) and (c <= d) then min := c
else if (d <= a) and (d <= b) and (d <= c) then min := d;
// Max
if (a >= b) and (a >= c) and (a >= d) then max := a
else if (b >= a) and (b >= c) and (b >= d) then max := b
else if (c >= a) and (c >= b) and (c >= d) then max := c
else if (d >= a) and (d >= b) and (d >= c) then max := d;
writeln('Min: ', min);
writeln('Max: ', max);
end.
285
Смежные вопросы: