Advertisement
TeMePyT

Untitled

Jun 2nd, 2018
106
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 _08_CenterPoint
  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.  
  14.             double perpendicular1 = Check(x1, y1);
  15.             double perpendicular2 = Check(x2, y2);
  16.  
  17.             if (perpendicular1 <= perpendicular2)
  18.             {
  19.                 Console.WriteLine($"({x1}, {y1})");
  20.             }
  21.             else
  22.             {
  23.                 Console.WriteLine($"({x2}, {y2})");
  24.              }
  25.  
  26.         }
  27.  
  28.         static double Check(double x, double y)
  29.         {
  30.             double cPow2 = Math.Pow(x, 2) + Math.Pow(y, 2);
  31.             return cPow2;
  32.  
  33.         }
  34.     }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement