65 767
Assignments Done
99,4%
Successfully Done
In October 2018

Answer to Question #46282 in Java | JSP | JSF for Fel

Question #46282
Java programming.
square root.

X = -b± √b2 – 4ac
2a
Find x
Expert's answer
import java.util.Scanner;
 
public classSquareRoot {
 
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Input a:");
        int a = input.nextInt();
        System.out.print("Input b:");
        int b = input.nextInt();
        System.out.print("Input c:");
        int c = input.nextInt();
    
        double x1 = (-b + Math.sqrt(b * b - 4 *a * c)) / (2 * a);
        double x2 = (-b - Math.sqrt(b * b - 4 *a * c)) / (2 * a);
        System.out.println("First root is" + x1 + " Second root: " + x2);
    }
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions