Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace _08.Center_Point
- {
- class Program
- {
- static void Main(string[] args)
- {
- double x1 = double.Parse(Console.ReadLine());
- double y1 = double.Parse(Console.ReadLine());
- double x2 = double.Parse(Console.ReadLine());
- double y2 = double.Parse(Console.ReadLine());
- Console.WriteLine("("+string.Join(", ",GetCloserpoint(x1, y1, x2, y2))+")");
- }
- private static double[] GetCloserpoint(double x1, double y1, double x2, double y2)
- {
- double d1 = Math.Pow(x1, 2) + Math.Pow(y1, 2);
- double d2 = Math.Pow(x2, 2) + Math.Pow(y2, 2);
- if(d1<=d2)
- {
- return new[] { x1, y1 };
- }
- else
- {
- return new[] { x2, y2 };
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement