Question #274337

10. The coordinates of two points in the plane are known. Find their distance

Create a program.

Expert's answer

```
using System;
using System.Collections.Generic;
namespace App
{
class Program
{
public static void Main()
{
double distance, x1, x2, y1, y2;
Console.Write("Enter coordinate X for point A: ");
x1 = Double.Parse(Console.ReadLine());
Console.Write("Enter coordinate Y for point A: ");
y1 = Double.Parse(Console.ReadLine());
Console.Write("Enter coordinate X for point B: ");
x2 = Double.Parse(Console.ReadLine());
Console.Write("Enter coordinate Y for point B: ");
y2 = Double.Parse(Console.ReadLine());
distance = Math.Sqrt(Math.Pow(x1 - x2, 2) + Math.Pow(y1 - y2, 2));
Console.WriteLine("Distance between points A and B: {0}", distance);
Console.ReadLine();
}
}
}
```

Learn more about our help with Assignments: C#

## Comments

## Leave a comment