Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.*;
- import java.lang.Math.*;
- class DistanceBwPoint
- {
- public static void main(String arg[])
- {
- Scanner scan = new Scanner( System.in );
- int x1,x2,y1,y2;
- double dis;
- System.out.print("Enter X1: ");
- x1 = scan.nextInt();
- System.out.print("Enter Y1: ");
- y1 = scan.nextInt();
- System.out.print("Enter X2: ");
- x2 = scan.nextInt();
- System.out.print("Enter Y2: ");
- y2 = scan.nextInt();
- dis=Math.sqrt((x2-x1)*(x2-x1) + (y2-y1)*(y2-y1));
- System.out.println("distance between"+"("+x1+","+y1+"),"+"("+x2+","+y2+")="+dis);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement