i think i have written the correct code but it is not working correctly
Program not working properly
import java.util.*; public class Main { public static void main(String args[]) { double d = 0, e = 0, f; Scanner sc = new Scanner(System.in); double a = sc.nextDouble(); double b = sc.nextDouble(); double c = sc.nextDouble(); if (a >= -100 && c <= 100) { f = (b * b) - (4 * a * c); double g = Math.sqrt(f); if (f > 0) { d = (-b + g) / (2 * a); e = (-b - g) / (2 * a); System.out.println(“Real And Distinct”); System.out.println(d + " " + e); } else if (f == 0) { System.out.println(“Real And Same”); System.out.println((-b + g) / (2 * a)); } } } }
@jatin111 Real and Distinct , Real and Equal or Imaginary
You need to print these for each case. You have printed real and same and imaginary is not there
still it is not able to pass test case 2 and 3
test case 1 and 2 and not 2 and 3
@jatin111 i have made the changes to you code
Please mark your doubt as resolved if u are satisfied with the answer.