Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. package javaapplication5;
  2.  
  3. import java.util.*;
  4.  
  5.  
  6. public class JavaApplication5{
  7.  
  8.  
  9. public static void main(String[] args) {
  10. Scanner keyboard = new Scanner(System.in);
  11.  
  12. //Deklaration der Variablen
  13. double x, y, z, L;
  14.  
  15. //Eingeben der Werte
  16. System.out.println("Geben Sie x ein ");
  17. x = keyboard.nextDouble();
  18. System.out.println("Geben Sie y ein");
  19. y = keyboard.nextDouble();
  20. System.out.println("Geben Sie z ein");
  21. z = keyboard.nextDouble();
  22.  
  23. if (x == 1 && y == 0 && z == 0)
  24. {
  25. System.out.println("Es handelt sich um einen ex Basisvektor");
  26. }
  27.  
  28. if (x == 0 && y == 1 && z == 0)
  29. {
  30. System.out.println("Es handelt sich um einen ey Basisvektor");
  31. }
  32. if (x == 0 && y == 0 && z == 1)
  33. {
  34. System.out.println("Es handelt sich um einen ez Basisvektor");
  35. }
  36.  
  37. L = (x*x+y*y+z*z);
  38. System.out.println(L);
  39.  
  40. L = Math.sqrt(L) ;
  41. System.out.println("Die Länge des Vektors ist " + L);
  42.  
  43. }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement