Example #1
0
        static void Main()
        {
            Podouble firstPodouble = new Podouble();

            firstPodouble.x = double.Parse(Console.ReadLine());
            firstPodouble.y = double.Parse(Console.ReadLine());
            Podouble secondPodouble = new Podouble();

            secondPodouble.x = double.Parse(Console.ReadLine());
            secondPodouble.y = double.Parse(Console.ReadLine());
            PrdoubleThePoinCloserToZero(firstPodouble, secondPodouble);
        }
Example #2
0
        private static void PrdoubleThePoinCloserToZero(Podouble firstPodouble, Podouble secondPodouble)
        {
            double firstDistance  = GetDistance(firstPodouble);
            double secondDistance = GetDistance(secondPodouble);

            if (firstDistance <= secondDistance)
            {
                Prdouble(firstPodouble);
            }
            else
            {
                Prdouble(secondPodouble);
            }
        }
Example #3
0
        private static double GetDistance(Podouble p)
        {
            double distance = Math.Sqrt(p.x * p.x + p.y * p.y);

            return(distance);
        }
Example #4
0
 private static void Prdouble(Podouble p)
 {
     Console.WriteLine($"({p.x}, {p.y})");
 }