Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- class LongerLine
- {
- static void Main()
- {
- double x1 = double.Parse(Console.ReadLine());
- double y1 = double.Parse(Console.ReadLine());
- double x2 = double.Parse(Console.ReadLine());
- double y2 = double.Parse(Console.ReadLine());
- double x3 = double.Parse(Console.ReadLine());
- double y3 = double.Parse(Console.ReadLine());
- double x4 = double.Parse(Console.ReadLine());
- double y4 = double.Parse(Console.ReadLine());
- PrintLongerLine(x1, y1, x2, y2, x3, y3, x4, y4);
- }
- static void PrintLongerLine(double x1, double y1, double x2, double y2, double x3, double y3, double x4, double y4)
- {
- double firstLineLen = Math.Sqrt(Math.Pow((x2 - x1), 2) + Math.Pow((y2 - y1), 2));
- double secondLineLen = Math.Sqrt(Math.Pow((x4 - x3), 2) + Math.Pow((y4 - y3), 2));
- if (firstLineLen >= secondLineLen)
- {
- if (Math.Abs(x1) <= Math.Abs(x2) && Math.Abs(y1) <= Math.Abs(y2))
- {
- Console.WriteLine($"({x1}, {y1})({x2}, {y2})");
- }
- else
- {
- Console.WriteLine($"({x2}, {y2})({x1}, {y1})");
- }
- }
- else
- {
- if (Math.Abs(x3) <= Math.Abs(x4) && Math.Abs(y3) <= Math.Abs(y4))
- {
- Console.WriteLine($"({x3}, {y3})({x4}, {y4})");
- }
- else
- {
- Console.WriteLine($"({x4}, {y4})({x3}, {y3})");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement