tandaleyo

Untitled

Jun 8th, 2017
149
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.  
  3.  
  4. namespace ProgrammingAssignment1
  5. {
  6. class Program
  7. {
  8. static void Main()
  9. {
  10. Console.WriteLine("Hello, this application will calculate the distance between two points and the angle between those points.");
  11. Console.WriteLine("Please enter X value for point 1:");
  12. float point1X = float.Parse(Console.ReadLine());
  13.  
  14. Console.WriteLine("Please enter Y value for point 1:");
  15. float point1Y = float.Parse(Console.ReadLine());
  16.  
  17. Console.WriteLine("Please enter X value for point 2:");
  18. float point2X = float.Parse(Console.ReadLine());
  19.  
  20. Console.WriteLine("Please enter Y value for point 2");
  21. float point2Y = float.Parse(Console.ReadLine());
  22.  
  23. double distance = Math.Sqrt(Math.Pow((point2X - point1X), 2) + Math.Pow((point2Y - point1Y), 2));
  24. Console.WriteLine("Distance between points: {0:f3}", distance);
  25.  
  26. double angle = Math.Atan2((point2Y - point1Y), (point2X - point1X)) * 180 / Math.PI;
  27. Console.WriteLine("Angle between points: {0:f3}", angle);
  28. }
  29. }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment