Last active
August 7, 2018 13:20
-
-
Save kocko/ad50dd42acc50030a2baefa37a3656e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.Scanner; | |
public class MyClass { | |
public static void main(String args[]) { | |
Scanner sc = new Scanner(System.in); | |
System.out.println("Vyvedete a"); | |
double a = sc.nextDouble(); | |
System.out.println("Vyvedete b"); | |
double b = sc.nextDouble(); | |
System.out.println("Vyvedete c"); | |
double c = sc.nextDouble(); | |
double x1, x2; | |
double diskriminanta = Math.sqrt(Math.pow(b, 2) - (4 * a * c)); | |
if (diskriminanta < 0) { | |
System.out.println("Uravnenieto nqma realni koreni we balyk"); | |
} else { | |
x1 = (-b + diskriminanta) / 2 * a; | |
x2 = (-b - diskriminanta) / 2 * a; | |
System.out.println(x1); | |
System.out.println(x2); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment