Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace DistanceBetweenPoint
- {
- class Program
- {
- static void Main(string[] args)
- {
- var FirstLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
- var firstPoint = new Point()
- {
- x = FirstLine[0],
- y = FirstLine[1]
- };
- var secoundLine = Console.ReadLine().Split().Select(int.Parse).ToArray();
- var secoundPoint = new Point()
- {
- x = secoundLine[0],
- y = secoundLine[1]
- };
- var result = Distance(firstPoint, secoundPoint);
- Console.WriteLine($"{result:f3}");
- }
- public static double Distance(Point firstPoint, Point secoundPoint)
- {
- var squareX = Math.Pow(firstPoint.x - secoundPoint.x ,2);
- var squareY = Math.Pow(firstPoint.y - secoundPoint.y, 2);
- var result = Math.Sqrt(squareX + squareY);
- return result;
- }
- class Point
- {
- public int x { get; set; }
- public int y { get; set; }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement