Advertisement
Stradjazz

Untitled

Jan 25th, 2017
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 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. int coordX1 = int.Parse(Console.ReadLine());
  14. int coordY1 = int.Parse(Console.ReadLine());
  15. int coordX2 = int.Parse(Console.ReadLine());
  16. int coordY2 = int.Parse(Console.ReadLine());
  17. PointClosestToCenter(coordX1, coordY1, coordX2, coordY2);
  18. }
  19. public static void PointClosestToCenter(int coordX1, int coordY1, int coordX2, int coordY2)
  20. {
  21. int firstPoint = (int)Math.Sqrt((coordX1 * coordX1) + (coordY1 * coordY1));
  22. int secondPoint =(int)Math.Sqrt((coordX2 * coordX2) + (coordY2 * coordY2));
  23.  
  24. if (firstPoint < secondPoint)
  25. {
  26. Console.WriteLine($"({coordX1}, {coordY1})");
  27. }
  28. else if (firstPoint > secondPoint)
  29. {
  30. Console.WriteLine($"({coordX2}, {coordY2})");
  31. }
  32. else
  33. {
  34. Console.WriteLine($"({coordX1}, {coordY1})");
  35. }
  36. }
  37. }
  38. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement