Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

import java.util.Scanner; public class Exercise03-01 { public static void main(String[] args) { Scanner scan= new Scanner(System.in); System.out.println(Enter a, b, c: ); double a= input.nextDouble(); double

import java.util.Scanner;

public class Exercise03-01 { public static void main(String[] args) { Scanner scan= new Scanner(System.in); System.out.println("Enter a, b, c: "); double a= input.nextDouble(); double b= input.nextDouble(); double c= input.nextDouble();

double discriminant = b * b - 4 * a * c; if (discriminant < 0) { System.out.println("The equation has one root "); } else if (discriminant "" 0} { double r1 = -b / (2 * a); System.out.println("The equation has one root " + r1); } else { // (discriminant > 0} double r1 = (-b + Math.pow(discriminant, 0.5)) / (2 * a); double r2 = (-b - Math.pow(discriminant, 0.5)) / (2 * a); System.outprintln("The equation has two roots " + rl + " + r2); } } }

why its giving me a wrong answer?

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Time Series Databases New Ways To Store And Access Data

Authors: Ted Dunning, Ellen Friedman

1st Edition

1491914726, 978-1491914724

More Books

Students also viewed these Databases questions

Question

What is cost plus pricing ?

Answered: 1 week ago

Question

1. What are the types of wastes that reach water bodies ?

Answered: 1 week ago

Question

Which type of soil has more ability to absorb water?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago