Answers for "Input the coördinates and calculate the distance between them c#"

C#
0

Input the coördinates and calculate the distance between them c#

static void Main() {
  double d, x1, x2, y1, y2;
 
  Console.Write("Enter coordinates for point A: ");
  x1 = Double.Parse(Console.ReadLine());
  y1 = Double.Parse(Console.ReadLine());
 
  Console.Write("Enter coordinates for point B: ");
  x2 = Double.Parse(Console.ReadLine());
  y2 = Double.Parse(Console.ReadLine());
   
  d = Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
     
  Console.Write("Distance between points: " + d);
  Console.ReadKey();
}
Posted by: Guest on October-13-2020

Code answers related to "Input the coördinates and calculate the distance between them c#"

C# Answers by Framework

Browse Popular Code Answers by Language