Skip to content

Instantly share code, notes, and snippets.

Created October 8, 2017 15:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/24436723186c63b628b90840f33da1c7 to your computer and use it in GitHub Desktop.
Save anonymous/24436723186c63b628b90840f33da1c7 to your computer and use it in GitHub Desktop.
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