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 ConsoleApplication79
- {
- class Program
- {
- public static void Vector()
- {
- double[] vec1 = new double[2]; //1st Vector
- double[] vec2 = new double[2]; //2nd Vector
- Console.WriteLine(" please write the [x]-axis for the 1st Vector");
- vec1[0] = double.Parse(Console.ReadLine());
- Console.WriteLine(" please write the [y]-axis for the 1st Vector");
- vec1[1] = double.Parse(Console.ReadLine());
- Console.WriteLine(" please write the [x]-axis for the 2nd Vector");
- vec2[0] = double.Parse(Console.ReadLine());
- Console.WriteLine(" please write the [y]-axis for the 2nd Vector");
- vec2[1] = double.Parse(Console.ReadLine());
- double angle = Math.Acos((vec1[0] * vec2[0] + vec1[1] * vec2[1]) / (Math.Sqrt(Math.Pow(vec1[0], 2) + Math.Pow(vec1[1], 2)) * (Math.Sqrt(Math.Pow(vec2[0], 2) + Math.Pow(vec2[1], 2))))) * (180 /Math.PI);
- Console.WriteLine("Angle:", +angle);
- //(U.V) / (||u||*||v||)
- }
- static void Main(string[] args)
- {
- Vector();
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement