Advertisement
PlamenMI81

08. Center Point

Oct 5th, 2017
477
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.79 KB | None | 0 0
  1. using System;
  2.  
  3. namespace _08_Center_Point
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             double x1 = double.Parse(Console.ReadLine());
  10.             double y1 = double.Parse(Console.ReadLine());
  11.             double x2 = double.Parse(Console.ReadLine());
  12.             double y2 = double.Parse(Console.ReadLine());
  13.             NearestToCenter(x1, y1, x2, y2);
  14.         }
  15.  
  16.         private static void NearestToCenter(double x1, double y1, double x2, double y2)
  17.         {
  18.             double x1Abs = Math.Abs(x1);
  19.             double y1Abs = Math.Abs(y1);
  20.             double x2Abs = Math.Abs(x2);
  21.             double y2Abs = Math.Abs(y2);
  22.             Console.WriteLine(x1Abs + y1Abs <= x2Abs + y2Abs ? $"({x1}, {y1})" : $"({x2}, {y2})");
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement