Answer the question
In order to leave comments, you need to log in
Did you solve the problem correctly?
Given:
Write a program to solve a quadratic equation. A quadratic equation is an equation of the form ax2 + bx + c = 0; Please note that the input and result can be with a decimal part.
my decision:
package java2;
import java.util.Scanner;
import java.math.*;
public class SecondHomeWork {
public static void main(String[] args) {
Scanner scan = new Scanner(System.in);
System.out.println("Введите значение a: ");
double valueA = scan.nextDouble();
System.out.println("Введите значение b: ");
double valueB = scan.nextDouble();
System.out.println("Введите значение c: ");
double valueC = scan.nextDouble();
double result = (valueB * valueB) - (4 * valueA * valueC);
System.out.println(result);
}
}
Answer the question
In order to leave comments, you need to log in
Not right. Even mathematically wrong.
b^2-4ac is the discriminant formula. Not roots.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question