Info10Repository/Mitternachtsformelrechner.java

40 lines
683 B
Java

import java.util.Scanner;
public class Mitternachtsformelrechner
{
public static void Mitternachtsformelrechner()
{
Scanner sc = new Scanner(System.in);
System.out.println("Erste Zahl eingebne:");
double a = sc.nextInt();
System.out.println("Zweite Zahl eingebne:");
double b = sc.nextInt();
System.out.println("Dritte Zahl eingebne:");
double c = sc.nextInt();
double root;
root = Math.sqrt((b * b) - (4 * a * c));
double bottom;
bottom = (2 * a);
double result1;
result1 = (-b + root) / bottom;
System.out.print("x1=:");
System.out.println(result1);
double result2;
result2 = (-b - root) / bottom;
System.out.print("x2=:");
System.out.println(result2);
}
}