fork download
  1. /* package whatever; // don't place package name! */
  2.  
  3. import java.util.*;
  4. import java.lang.*;
  5. import java.io.*;
  6.  
  7. /* Name of the class has to be "Main" only if the class is public. */
  8. class Ideone
  9. {
  10. public static void main (String[]args){
  11. int x;
  12. int y;
  13. double Distance;
  14. x= (int) (Math.random() * 10)+1;
  15. y= (int)(Math.random() * 10)+1;
  16. Distance= (x*x)+(y*y);
  17. Distance = Math.sqrt (Distance);
  18. System.out.println("The distance between coordinate " +(x)+","+(y)+ " and the origin is " +(Distance));
  19.  
  20.  
  21. }
  22. }
Success #stdin #stdout 0.1s 320576KB
stdin
Standard input is empty
stdout
The distance between coordinate 3,10 and the origin is 10.44030650891055