Advertisement
mess0011

ue5_5

Nov 14th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.33 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication79
  8. {
  9.     class Program
  10.     {
  11.         public static void Vector()
  12.         {
  13.             double[] vec1 = new double[2]; //1st Vector
  14.             double[] vec2 = new double[2]; //2nd Vector
  15.  
  16.             Console.WriteLine(" please write the [x]-axis for the 1st Vector");
  17.             vec1[0] = double.Parse(Console.ReadLine());
  18.             Console.WriteLine(" please write the [y]-axis for the 1st Vector");
  19.             vec1[1] = double.Parse(Console.ReadLine());
  20.  
  21.             Console.WriteLine(" please write the [x]-axis for the 2nd Vector");
  22.             vec2[0] = double.Parse(Console.ReadLine());
  23.             Console.WriteLine(" please write the [y]-axis for the 2nd Vector");
  24.             vec2[1] = double.Parse(Console.ReadLine());
  25.  
  26.             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);
  27.  
  28.             Console.WriteLine("Angle:", +angle);
  29.            
  30.             //(U.V) / (||u||*||v||)
  31.         }
  32.  
  33.         static void Main(string[] args)
  34.         {
  35.             Vector();
  36.             Console.ReadLine();
  37.         }
  38.     }
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement