Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- int x1;
- int x2;
- int y1;
- int y2;
- double m;
- double yint;
- Console.Write("Enter x1 value: ");
- x1 = Convert.ToInt16(Console.ReadLine());
- Console.Write("Enter x2 value: ");
- x2 = Convert.ToInt16(Console.ReadLine());
- Console.Write("Enter y1 value: ");
- y1 = Convert.ToInt16(Console.ReadLine());
- Console.Write("Enter y2 value: ");
- y2 = Convert.ToInt16(Console.ReadLine());
- Console.WriteLine();
- m = slope(x1,x2,y1,y2);
- yint = yInt(x1, y1, m);
- Console.WriteLine("Slope: " + m);
- Console.WriteLine("Y-Intercept: " + yint);
- }
- //x1,x2,y1,y2
- static double slope(int a, int b, int c, int d)
- {
- double m = (d-c) / (b-a);
- return m;
- }
- //x,y,slope
- static double yInt(int a, int b, double c)
- {
- double testNum = a*c;
- double yIntercept = b - (testNum);
- return yIntercept;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement