Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.81 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. int[,] cordinates = new int[2, 2];
  6.  
  7. Console.Write("Enter x for A: ");
  8. cordinates[0, 0] = int.Parse(Console.ReadLine());
  9. Console.Write("Enter y for A: ");
  10. cordinates[0, 1] = int.Parse(Console.ReadLine());
  11.  
  12. Console.Write("Enter x for B: ");
  13. cordinates[1, 0] = int.Parse(Console.ReadLine());
  14. Console.Write("Enter y for B: ");
  15. cordinates[1, 1] = int.Parse(Console.ReadLine());
  16.  
  17. double distance = Math.Sqrt(Math.Pow(cordinates[0, 0] - cordinates[1, 0], 2)
  18. + Math.Pow(cordinates[0, 1] - cordinates[1, 1], 2));
  19.  
  20. Console.WriteLine("Distance between A and B is: {0:0.000}", distance);
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement