Skip to content

Instantly share code, notes, and snippets.

Created November 14, 2017 16:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/d016caf69537f07ded7d9ff666feb0bd to your computer and use it in GitHub Desktop.
Save anonymous/d016caf69537f07ded7d9ff666feb0bd to your computer and use it in GitHub Desktop.
import java.util.Scanner;
public class Wyklad4 {
public static double dystans() {
Scanner odczyt = new Scanner(System.in);
System.out.println("Podaj x1");
int x = odczyt.nextInt();
System.out.println("Podaj y1");
int y = odczyt.nextInt();
System.out.println("Podaj x2");
int z = odczyt.nextInt();
System.out.println("Podaj y2");
int v = odczyt.nextInt();
odczyt.close();
return Math.sqrt(((z-x)*(z-x))+((v-y)*(v-y)));
}
public static void main(String[] args) {
double wynik = dystans();
System.out.println("Odległość punktów wynosi " +wynik);
System.out.println("Autor programu: XYZ");
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment