Created
October 8, 2017 15:25
-
-
Save anonymous/24436723186c63b628b90840f33da1c7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
namespace _08.Center_Point | |
{ | |
public class Program | |
{ | |
public static void Main() | |
{ | |
ClosestToTheCentre(); | |
} | |
private static void ClosestToTheCentre() | |
{ | |
var x1 = double.Parse(Console.ReadLine()); | |
var y1 = double.Parse(Console.ReadLine()); | |
var x2 = double.Parse(Console.ReadLine()); | |
var y2 = double.Parse(Console.ReadLine()); | |
var result = new List<double>(); | |
if (Math.Abs(x1) > Math.Abs(x2)) | |
{ | |
result.Add(x2); | |
} | |
else if (Math.Abs(x1) < Math.Abs(x2)) | |
{ | |
result.Add(x1); | |
} | |
else | |
{ | |
result.Add(x2); | |
} | |
if (Math.Abs(y1) > Math.Abs(y2)) | |
{ | |
result.Add(y2); | |
} | |
else if (Math.Abs(y1) < Math.Abs(y2)) | |
{ | |
result.Add(y1); | |
} | |
else | |
{ | |
result.Add(y2); | |
} | |
Console.WriteLine("(" + string.Join(", ", result) + ")"); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment