Решите в Pascal: известно расстояние до каждого из трёх сёл от районного центра. Определить, какое из них находится ближе всего к районному центру, а какое дальше всего от него
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.');
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.