Advertisement
gospod1978

Methods-Ex\More\Center Point

Oct 14th, 2019
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.96 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Numerics;
  5.  
  6. namespace methods_exerci
  7. {
  8.     class Program
  9.     {
  10.         static void Main(string[] args)
  11.         {
  12.  
  13.             double x1 = double.Parse(Console.ReadLine());
  14.             double y1 = double.Parse(Console.ReadLine());
  15.             double x2 = double.Parse(Console.ReadLine());
  16.             double y2 = double.Parse(Console.ReadLine());
  17.  
  18.             ClosestPoint(x1, y1, x2, y2);
  19.         }
  20.  
  21.         static void ClosestPoint(double x1, double y1, double x2, double y2)
  22.         {
  23.             double first = Math.Sqrt(Math.Pow(y1, 2) + Math.Pow(x1, 2));
  24.             double secound = Math.Sqrt(Math.Pow(y2, 2) + Math.Pow(x2, 2));
  25.  
  26.             if (first < secound)
  27.             {
  28.                 Console.WriteLine("({0}, {1})", x1, y1);
  29.             }
  30.             else
  31.             {
  32.                 Console.WriteLine("({0}, {1})", x2, y2);
  33.             }
  34.         }
  35.     }
  36. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement