Advertisement
Guest User

Untitled

a guest
Sep 30th, 2016
332
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.89 KB | None | 0 0
  1. using System;
  2.  
  3.  
  4. namespace CoordinatePoint
  5. {
  6. class CoordinatePoint
  7. {
  8. static void Main()
  9. {
  10. double x1 = double.Parse(Console.ReadLine());
  11. double y1 = double.Parse(Console.ReadLine());
  12.  
  13. double x2 = double.Parse(Console.ReadLine());
  14. double y2 = double.Parse(Console.ReadLine());
  15. PrintClosestPoints(x1, y1, x2, y2);
  16. }
  17.  
  18. private static void PrintClosestPoints(double x1, double y1, double x2, double y2)
  19. {
  20. double DistanceFromPointToCenter1 = Math.Sqrt(x1 * x1 + y1 * y1);
  21. double DistanceFromPointToCenter2 = Math.Sqrt(x2 * x2 + y2 * y2);
  22.  
  23. if (DistanceFromPointToCenter1 < DistanceFromPointToCenter2)
  24. Console.WriteLine("({0}, {1})", x1, y1);
  25. else
  26. Console.WriteLine("({0}, {1})", x2, y2);
  27. }
  28.  
  29.  
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement