View Code of Problem 42

import java.util.Scanner;
 
public class Main {
 
	public static void main(String[] args) {
		int a,b,c;
		Scanner sc = new Scanner(System.in);
		a = sc.nextInt();
		b = sc.nextInt();
          	c = sc.nextInt();
          	double d=(-b+Math.sqrt(b*b-4*a*c))/(a*2.0);
          	double e=(-b-Math.sqrt(b*b-4*a*c))/(a*2.0);
		System.out.println(String.format("%.2f %.2f",d,e));
          	
	}
 
}

Double click to view unformatted code.


Back to problem 42