Digitally_Neon

Program.cs - C# find slope of two points

Jan 21st, 2021
909
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // slope of 2 points
  2. static void Main(string[] args)
  3.         {
  4.             // (1, 1) (1, 1)
  5.             string E = Console.ReadLine();
  6.            
  7.             int X1 = int.Parse(E.Split('(')[1].Split(',')[0]);
  8.             int X2 = int.Parse(E.Split('(')[1].Split(',')[1].Split(')')[0]);
  9.             int Y1 = int.Parse(E.Split('(')[2].Split(',')[0]);
  10.             int Y2 = int.Parse(E.Split('(')[2].Split(',')[1].Split(')')[0]);
  11.             Console.WriteLine((Y1 - Y2) / (X1 - X2));
  12.             Main(null);
  13.         }
RAW Paste Data