Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A quadratic equation is an equation in the form ax^2 + bx + c = 0 or that can be

ID: 673270 • Letter: A

Question

A quadratic equation is an equation in the form ax^2 + bx + c = 0 or that can be algebraically manipulated into this form. In this equation x is the unknown variable, and a, b, and c are known constants. Although the constants b and c can be any numbers, including zero, the value of the constant a cannot be zero (if a is zero, the equation becomes a linear equation in x). In order to solve a quadratic equation ax^2 + bx + c = 0, one can proceed as follows: Compute the discriminant D = b^2 - 4ac If D > 0, the quadratic equation has two real roots that can be calculated using the quadratic formula: x_1 = and x_2 = If D = 0, the quadratic equation has one real root that can be calculated by the formula x = - b/2a If D

Explanation / Answer

#include <iostream>
#include <cmath>
using namespace std;
int main(){
int a, b, c;
   double D;
float r1, r2;
cout<<"Enter a b c";
cin>>a>>b>>c;
D = b * b - 4 * a * c; //Descriminat calculation
if(D > 0){
    cout<<"Two Real Roots";
r1 = (-b + sqrt(D))/(2*a);
       r2 = (-b - sqrt(D))/(2*a);
       cout<<"r1="<<r1<<" r2="<<r2<<endl;
}else if(D == 0){
    cout<<"One Real Root";
r1 = (-b)/(2*a);
       cout<<"r1="<<r1<<endl;
}else if (D < 0){
    cout<<"No Real Roots"<<endl;
}
   }

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote