Advertisement
koksibg

Center_Point

Oct 4th, 2016
408
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Center_Point
  8. {
  9.     class Center_Point
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             double x1 = double.Parse(Console.ReadLine());
  14.             double y1 = double.Parse(Console.ReadLine());
  15.             double x2 = double.Parse(Console.ReadLine());
  16.             double y2 = double.Parse(Console.ReadLine());
  17.             double distanceFirstPoint = Distance(x1, y1);
  18.             double disttanceSecondPoint = Distance(x2, y2);
  19.             if (distanceFirstPoint < disttanceSecondPoint)
  20.             Console.WriteLine($"({x1}, {y1})");
  21.             else Console.WriteLine($"({x2}, {y2})");
  22.         }
  23.  
  24.         public static double Distance(double x, double y)
  25.         {
  26.             double distance = Math.Sqrt(Math.Pow(x, 2) + Math.Pow(y, 2));
  27.             return distance;
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement