TheBulgarianWolf

Longer Line

Nov 2nd, 2020
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.16 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MoreMethodExercises
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int x1 = int.Parse(Console.ReadLine());
  10.             int y1 = int.Parse(Console.ReadLine());
  11.             int x2 = int.Parse(Console.ReadLine());
  12.             int y2 = int.Parse(Console.ReadLine());
  13.             int x3 = int.Parse(Console.ReadLine());
  14.             int y3 = int.Parse(Console.ReadLine());
  15.             int x4 = int.Parse(Console.ReadLine());
  16.             int y4 = int.Parse(Console.ReadLine());
  17.             double firstDistance = Math.Sqrt(Math.Pow((x2-x1), 2) + Math.Pow((y2-y1), 2));
  18.             double secondDistance = Math.Sqrt(Math.Pow((x4-x3), 2) + Math.Pow((y4-y3), 2));
  19.  
  20.             if(firstDistance > secondDistance)
  21.             {
  22.                 Console.WriteLine("({0},{1}) ({2},{3})",x1,y1,x2,y2);
  23.             }
  24.             else if(secondDistance > firstDistance)
  25.             {
  26.                 Console.WriteLine("({0},{1}) ({2},{3})", x3,y3,x4,y4);
  27.             }
  28.             else
  29.             {
  30.                 Console.WriteLine("({0},{1}) ({2},{3})", x1, y1, x2, y2);
  31.             }
  32.         }
  33.     }
  34. }
  35.  
Add Comment
Please, Sign In to add comment