Решите в Pascal: известно расстояние до каждого из трёх сёл от районного центра. Определить, какое из них находится ближе всего к районному центру, а какое дальше всего от него

11 Окт 2019 в 23:42
191 +1
0
Ответы
1

program closest_village;

var
distance1, distance2, distance3: integer;

begin
writeln('Enter the distance to the first village:');
readln(distance1);

writeln('Enter the distance to the second village:');
readln(distance2);

writeln('Enter the distance to the third village:');
readln(distance3);

if (distance1 < distance2) and (distance1 < distance3) then
writeln('The first village is closest to the district center.');
if (distance2 < distance1) and (distance2 < distance3) then
writeln('The second village is closest to the district center.');
if (distance3 < distance1) and (distance3 < distance2) then
writeln('The third village is closest to the district center.');

if (distance1 > distance2) and (distance1 > distance3) then
writeln('The first village is farthest from the district center.');
if (distance2 > distance1) and (distance2 > distance3) then
writeln('The second village is farthest from the district center.');
if (distance3 > distance1) and (distance3 > distance2) then
writeln('The third village is farthest from the district center.');

end.

19 Апр 2024 в 12:01
Не можешь разобраться в этой теме?
Обратись за помощью к экспертам
Гарантированные бесплатные доработки в течение 1 года
Быстрое выполнение от 2 часов
Проверка работы на плагиат
Поможем написать учебную работу
Прямой эфир