forked from dharmanshu1921/Java
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBhaskForm.java
More file actions
Latest commit
24 lines (21 loc) · 751 Bytes
/
Copy pathBhaskForm.java
File metadata and controls
24 lines (21 loc) · 751 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
packagedemo1;
importjava.util.Scanner;
publicclassBhaskForm {
publicstaticvoidmain(String[] args) {
Scannersc = newScanner(System.in);
doubleA = sc.nextDouble();
doubleB = sc.nextDouble();
doubleC = sc.nextDouble();
doubledelta = Math.pow(B, 2) - (4 * (A * C));
if (delta == 0 || delta < 0 || A == 0) {
System.out.println("Impossivel calcular");
} else {
doublex = -B + Math.sqrt(delta);
doublexlinha = x / (2 * A);
doublex2 = -B - Math.sqrt(delta);
doublexdualinha = x2 / (2 * A);
System.out.printf("R1 = %.5f\n", xlinha);
System.out.printf("R2 = %.5f\n", xdualinha);
}
}
}