Advertisement
TeMePyT

Untitled

May 26th, 2018
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.00 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 _08.Center_Point
  8. {
  9. class Program
  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.  
  18. Console.WriteLine("("+string.Join(", ",GetCloserpoint(x1, y1, x2, y2))+")");
  19. }
  20.  
  21. private static double[] GetCloserpoint(double x1, double y1, double x2, double y2)
  22. {
  23. double d1 = Math.Pow(x1, 2) + Math.Pow(y1, 2);
  24. double d2 = Math.Pow(x2, 2) + Math.Pow(y2, 2);
  25. if(d1<=d2)
  26. {
  27. return new[] { x1, y1 };
  28.  
  29. }
  30. else
  31. {
  32. return new[] { x2, y2 };
  33.  
  34. }
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement