Advertisement
Guest User

02. Center Point

a guest
Oct 12th, 2019
1,463
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.87 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _02._Center_Point
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             double x1 = double.Parse(Console.ReadLine());
  10.             double y1 = double.Parse(Console.ReadLine());
  11.  
  12.             double x2 = double.Parse(Console.ReadLine());
  13.             double y2 = double.Parse(Console.ReadLine());
  14.  
  15.             PrintsClosestToTheCenterPoints(x1, y1, x2, y2);
  16.         }
  17.         static void PrintsClosestToTheCenterPoints(double x1, double y1, double x2, double y2)
  18.         {
  19.             double result = Math.Abs(x1) + Math.Abs(y1);
  20.             double result2 = Math.Abs(x2) + Math.Abs(y2);
  21.  
  22.             if (result < result2)
  23.             {
  24.                 Console.WriteLine($"({x1}, {y1})");
  25.             }
  26.             else
  27.             {
  28.                 Console.WriteLine($"({x2}, {y2})");
  29.             }
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement