Advertisement
PetarAsenov

qefq

Jan 17th, 2018
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.16 KB | None | 0 0
  1. using System;
  2. using System.Linq;
  3.  
  4. namespace Time_15Min
  5. {
  6. public class Program
  7. {
  8. static void Main(string[] args)
  9. {
  10. var firstLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
  11.  
  12. var firstPoint = new Point()
  13. {
  14. x = firstLine[0],
  15. y = firstLine[1]
  16. };
  17.  
  18. var secoundLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
  19.  
  20. var secoundPoint = new Point()
  21. {
  22. x = secoundLine[0],
  23. y = secoundLine[1]
  24. };
  25.  
  26. var result = Distance(firstPoint, secoundPoint);
  27. Console.WriteLine($"{result:f3}");
  28. }
  29.  
  30. public static double Distance(Point firstPoint, Point secoundPoint)
  31. {
  32. var squareX = Math.Pow(firstPoint.x - secoundPoint.x, 2);
  33. var squareY = Math.Pow(firstPoint.y - secoundPoint.y, 2);
  34.  
  35. var result = Math.Sqrt(squareX + squareY);
  36. return result;
  37. }
  38.  
  39. }
  40.  
  41. public class Point
  42. {
  43. public int x { get; set; }
  44.  
  45. public int y { get; set; }
  46. }
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement