Advertisement
svetlyoek

Untitled

Feb 14th, 2019
438
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace ConsoleApp170
  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. CheckClosestToNull(x1, y1, x2, y2);
  14. }
  15.  
  16. private static void CheckClosestToNull(double x1, double y1, double x2, double y2)
  17. {
  18.  
  19. if (Math.Abs(x1) > Math.Abs(x2))
  20. {
  21. Console.Write("("+x2+", ");
  22. }
  23. else if (Math.Abs(x2) > Math.Abs(x1))
  24. {
  25. Console.Write("("+x1+", ");
  26. }
  27. else
  28. {
  29. Console.Write("("+x1+", ");
  30. }
  31. if (Math.Abs(y1) > Math.Abs(y2))
  32. {
  33. Console.Write(y2+")");
  34. }
  35. else if (Math.Abs(y2) > Math.Abs(y1))
  36. {
  37. Console.Write(y1+")");
  38. }
  39. else
  40. {
  41. Console.Write(y1+")");
  42. }
  43.  
  44. }
  45.  
  46.  
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement