-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathbegin39.java
More file actions
36 lines (23 loc) · 701 Bytes
/
begin39.java
File metadata and controls
36 lines (23 loc) · 701 Bytes
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
27
28
29
30
31
32
33
34
35
36
package begin;
import java.util.Scanner;
public class begin39 {
public static void main(String[] args) {
float A;
float B;
float C;
Scanner scanner=new Scanner(System.in);
System.out.print("A:");
A = scanner.nextFloat();
System.out.print("B:");
B = scanner.nextFloat();
System.out.print("C:");
C = scanner.nextFloat();
float D;
D = (float) (Math.pow(B,2) - 4 * A * C);
float x1;
float x2;
x1 = (float) (((-1) * B + Math.sqrt(D)) / (2 * A));
x2 = (float) (((-1) * B - Math.sqrt(D)) / (2 * A));
System.out.printf("x1:%f\nx2:%f\n",x1,x2);
}
}