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)
- {
- int coordX1 = int.Parse(Console.ReadLine());
- int coordY1 = int.Parse(Console.ReadLine());
- int coordX2 = int.Parse(Console.ReadLine());
- int coordY2 = int.Parse(Console.ReadLine());
- PointClosestToCenter(coordX1, coordY1, coordX2, coordY2);
- }
- public static void PointClosestToCenter(int coordX1, int coordY1, int coordX2, int coordY2)
- {
- int firstPoint = (int)Math.Sqrt((coordX1 * coordX1) + (coordY1 * coordY1));
- int secondPoint =(int)Math.Sqrt((coordX2 * coordX2) + (coordY2 * coordY2));
- if (firstPoint < secondPoint)
- {
- Console.WriteLine($"({coordX1}, {coordY1})");
- }
- else if (firstPoint > secondPoint)
- {
- Console.WriteLine($"({coordX2}, {coordY2})");
- }
- else
- {
- Console.WriteLine($"({coordX1}, {coordY1})");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement