Computer Science, asked by np916872, 6 months ago

The co-ordinates of two points A and B on a straight line are given as (x1,y1) and (x2,y2). W.A.P. to

calculate the slope(m) of the line by using formula: Slope = (x2−x1)

(y2−y1)

Take the co-ordinates (x1,y1) and (x2,y2) as input.
plz give me answer very fast
❤️❤️ ​

Answers

Answered by maheemishra36
0

Answer:

x2.23

Explanation:

please mark me as beainlist

Answered by keshavrawat2005
8

Answer:

import java.util.Scanner;

class Slope

{

public static void main(String []s)

{

int x1, x2, y1, y2;

Scanner sc=new Scanner(System.in);

System.out.println("Enter the co-ordinates of A: x1 and y1");

x1=sc.nextInt();

y1=sc.nextInt();

System.out.println("Enter the co-ordinates of B: x2 and y2");

x2=sc.nextInt();

y2=sc.nextInt();

double slope = (y2 - y1)/(x1 - x2);

System.out.println("Slope of A and B are " + slope);

} // method ends here

} // class ends here

Explanation:

i hope it will help you!

Similar questions