import java.io.*; public class Distancia { public static void main(String []args) { BufferedReader in = new BufferedReader(new InputStreamReader(System.in)); try { String linha; int x1 =0,x2 = 0,y1 = 0,y2 = 0; double x = 0; System.out.println("DIGITE UM VALOR PARA: x1"); linha = in.readLine(); x1 = Integer.parseInt(linha); System.out.println("DIGITE UM VALOR PARA: x2"); linha = in.readLine(); x2 = Integer.parseInt(linha); System.out.println("DIGITE UM VALOR PARA: y1"); linha = in.readLine(); y1 = Integer.parseInt(linha); System.out.println("DIGITE UM VALOR PARA: y2"); linha = in.readLine(); y2 = Integer.parseInt(linha); if( x < 0) { throw new IllegalArgumentException(); } x=(Math.sqrt(Math.pow(x2-x1,(2)))*(Math.pow(y2-y1,(2)))); System.out.println("A DISTANCIA ENTRE OS PONTOS E:" + x); } catch(IOException e) { System.out.println("ERRO DE LEITURA"); } } } /* ALGORITMO QUE CALCULA DISTANCIA inicio; inteiro : d; real: x1, x2 ,y1, y2; leia( x1, x2 ,y1, y2); d <-- ( rad (pot(2, x2 - x1) + pot( 2, y2 - y1)); imprima ( d); fim; */