martes, 24 de mayo de 2016

distancia entre dos puntos

distancia entre dos puntos
class distanciaentredospuntos{

public static void main(String[]args)throws IOException

{

BufferedReader in=new BufferedReader(new InputStreamReader (System.in));

System.out.print("ingrese abscisa del primer punto:");

int x1=Integer.parseInt(in.readLine());

System.out.print("ingrese ordenada del primer punto:");

int y1=Integer.parseInt(in.readLine());

System.out.print("ingrese abscisa del segundo punto:");

int x2=Integer.parseInt(in.readLine());

System.out.print("ingrese ordenada del segundo punto:");

int y2=Integer.parseInt(in.readLine());

double distancia=((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1));

System.out.println("la distancia="+(Math.sqrt(distancia)));

}

}

No hay comentarios:

Publicar un comentario

ENTRADAS POPULARES