petyaminkova91

Untitled

Oct 13th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02_CenterPoint
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double x1 = double.Parse(Console.ReadLine());
  10. double y1 = double.Parse(Console.ReadLine());
  11. double x2 = double.Parse(Console.ReadLine());
  12. double y2 = double.Parse(Console.ReadLine());
  13.  
  14. PrintClosestToZeroPoint(x1, y1, x2, y2);
  15. }
  16.  
  17. static void PrintClosestToZeroPoint(double x1, double y1, double x2, double y2)
  18. {
  19. double firstPointResult = Math.Abs(x1) + Math.Abs(y1);
  20. double secondPointResult = Math.Abs(x2) + Math.Abs(y2);
  21.  
  22. if (firstPointResult <= secondPointResult)
  23. {
  24. Console.WriteLine($"({x1}, {y1})");
  25. }
  26. else
  27. {
  28. Console.WriteLine($"({x2}, {y2})");
  29. }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment