diff --git a/abcRechner.java b/abcRechner.java new file mode 100644 index 0000000..1e1291a --- /dev/null +++ b/abcRechner.java @@ -0,0 +1,68 @@ +import java.util.Scanner; + +public class abcRechner +{ + public static void abcrechenr() + { + //screen display + Scanner sc = new Scanner(System.in); + + System.out.println("Input first number"); + double a = sc.nextInt(); + + + System.out.println("Input second number"); + double b = sc.nextInt(); + + + System.out.println("Input thinrd number"); + double c = sc.nextInt(); + + + //program start + + double root; + root = Math.sqrt((b * b) - (4 * a * c)); + + double bottom; + bottom = 2 * a; + + double result1; + result1 = (-b + root) / bottom; + + double result2; + result2 = (-b - root) / bottom; + + //outputs + + if( root < 0) { + + System.out.print("no answer possible"); + } + else{ + + if( root == 0) { + + System.out.print("The answer is: "); + } + else{ + System.out.print("first answer is: "); + System.out.println(result1); + + System.out.print("second answer is: "); + System.out.println(result2); + + + } + + + + + + + + + + } +} +} \ No newline at end of file