public class Quadratic {
public static void main(String[] args) {
ouble a = 2.3, b = 4, c = 5.6; le root1, root2;
for real and different roots ant > 0) { + Ma th.sqrt(determinant)) / (2 det erminant)) / (2 * a);
double determinant = b * b - 4 * a * c;
onditio etermin t1 = (-b .sqrt(
tem.o ut root1 ,
ondition if(dete root1 =
s. 1
. format("root1 = %.2f and roo root2 ) ;
for real and equal roots rminant == 0) { root2 = -b / (2 * a);
.fo rmat("root1 = root2 = %.2f;"
naryPart);
ystem.out.format("root1 = %.2f+%.2fi and %.2fi", realPart, imaginaryPart, realPar
e= not real f r ots ar { ble realPart = -b / (2 *a); ble imaginaryPart = Math.sqrt(-determin
tem.out
Informatikkstudentenes tidsskrift ved UiO NR. 7 | Høst 2021