Advertisement
Nannoka

distancia

Aug 8th, 2014
254
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.33 KB | None | 0 0
  1. public class Principal {
  2.  
  3.     public static void main(String[] args) {
  4.          
  5.              //tem q transformar em double
  6.  
  7.         int x1 = 0;
  8.         int y1 = 5;
  9.         int x2 = 10;
  10.         int y2 = 20;
  11.         int D = 0;
  12.        
  13.         D = Math.sqrt(Math.pow((x2-x1),2) + Math.pow(y2-y1),2));
  14.  
  15.         System.out.println("Distancia entre Ponto1 e Ponto2: " + D);
  16.  
  17.     }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement