Make a program to solve the problem: given two points, given by their coordinates.
July 22, 2021 | education
| Make a program to solve the problem: given two points, given by their coordinates. Determine which one is closer to the origin.
Let the coordinates of two points on the plane A (x1, y1) and B (x2, y2) be known. The distance from the origin (0,0) and a point on the plane is calculated by the formula:
OA = root (x1 ^ 2 + y1 ^ 2)
OB = root (x2 ^ 2 + y2 ^ 2)
The further the point is from the origin, the greater the distance (the length of the corresponding segment).
Program Z1;
Var x1, y1, x2, y2: real;
begin
Readln (x1, y1);
Readln (x1, y1);
if sqrt (x1 * x1 + y1 * y1)> sqrt (x2 * x2 + y2 * y2) then writeln (‘Point B is closer to the origin’);
if sqrt (x1 * x1 + y1 * y1) <sqrt (x2 * x2 + y2 * y2) then writeln (‘Point A is closer to the origin’);
end.
One of the components of a person's success in our time is receiving modern high-quality education, mastering the knowledge, skills and abilities necessary for life in society. A person today needs to study almost all his life, mastering everything new and new, acquiring the necessary professional qualities.