Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- namespace ProgrammingAssignment1
- {
- class Program
- {
- static void Main()
- {
- Console.WriteLine("Hello, this application will calculate the distance between two points and the angle between those points.");
- Console.WriteLine("Please enter X value for point 1:");
- float point1X = float.Parse(Console.ReadLine());
- Console.WriteLine("Please enter Y value for point 1:");
- float point1Y = float.Parse(Console.ReadLine());
- Console.WriteLine("Please enter X value for point 2:");
- float point2X = float.Parse(Console.ReadLine());
- Console.WriteLine("Please enter Y value for point 2");
- float point2Y = float.Parse(Console.ReadLine());
- double distance = Math.Sqrt(Math.Pow((point2X - point1X), 2) + Math.Pow((point2Y - point1Y), 2));
- Console.WriteLine("Distance between points: {0:f3}", distance);
- double angle = Math.Atan2((point2Y - point1Y), (point2X - point1X)) * 180 / Math.PI;
- Console.WriteLine("Angle between points: {0:f3}", angle);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment