-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathFun17.java
26 lines (23 loc) · 807 Bytes
/
Fun17.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
public class Fun17 {
public static void main(String[] args) {
solution(4.0,-4.0,1.0);
}
public static void solution (double a,double b, double c){
float D;
D = (float) (Math.pow(b,2) - 4 * a * c);
if (D>0){
float x1;
float x2;
x1 = (float) (((-1) * b + Math.sqrt(D)) / (2 * a));
x2 = (float) (((-1) * b - Math.sqrt(D)) / (2 * a));
double y = x1-x2-c;
System.out.println("X1:"+x1);
System.out.println("X2:"+x2);
System.out.println(y);
}else if (D==0){
System.out.println("1 ta ildizga ega");
}else {
System.out.println("Ildizga ega emas");
}
}
}