Aliendreamer

methodsExample

Mar 20th, 2018
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2.  
  3. namespace CenterPodouble
  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.             string result=CheckPoints(x1,y1,x2,y2);
  14.             Console.WriteLine(result);
  15.             // Console.WriteLine(CheckPoints(x1,y1,x2,y2))
  16.            
  17.         }
  18.     }
  19.     static string CheckPoints(double x,double y,double d,double z)
  20.       {
  21.             double diagonalFirstPoint = (Math.Sqrt(x1 * x1 + y1 * y1));
  22.             double diagonalSecondPoint = (Math.Sqrt(x2 * x2 + y2 * y2));
  23.             if (diagonalFirstPoint<=diagonalSecondPoint)
  24.             {
  25.              return $"({x1}, {y1})");
  26.             }
  27.             else
  28.             {
  29.                 return $"({x2}, {y2})");
  30.  
  31.             }
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment