Advertisement
XB74ck

u

Aug 14th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.63 KB | None | 0 0
  1. import java.util.Scanner;
  2.  
  3. public class UE3_3_class {
  4.  
  5.   public static double a;
  6.   public static double b;
  7.   public static double x;
  8.   public static double sprungweite = 0.5;
  9.  
  10.   public static void main(String[] args) {
  11.  
  12.     Scanner sc = new Scanner(System.in);
  13.  
  14.     System.out.println("Geben Sie a ein");
  15.     a = sc.nextDouble();
  16.  
  17.     System.out.println("Geben Sie b ein");
  18.     b = sc.nextDouble();
  19.  
  20.     for (boolean i = false; i == false; x = x + sprungweite) {
  21.  
  22.       if (a * x + b == 0) {
  23.         i = true;
  24.       } else {
  25.         i = false;
  26.       }
  27.     }
  28.  
  29.     System.out.println("x=" + (x - sprungweite));
  30.   }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement