#include
#include
using namespace std;
int main()
{
float a, b, c, d;
float root1, root2, img, real;
cout<<“Enter the coefficients of quadratic equation (ax^2+bx+c=0)\n”;
cin>>a>>b>>c;
if (a==0)
{
cout<<“Equation is quadratic valid”;
}
else
{
d = bb - 4ac;
if(d>0)
{
root1=(-b+sqrt(d))/(2a);
root2=(-b-sqrt(d))/(2a);
cout<<"\nRoots are real and distinct";
cout<<"\nRoots are “<<root1<<” and "<<root2;
}
else if(d==0)
{
root1=root2=-b/(2a);
cout<<"\nRoots are real and equal";
cout<<"\nRoots are “<<root1<<” and “<<root2;
}
else{
real = -b/(2a);
img = sqrt(-d)/(2a);
cout<<”\nRoots are complex and imaginary";
cout<<"\nRoots are “<<real<<”+"<<img<<“i and “<<real<<”-”<<img<<“i”;
}
return 0;
}
}
Https://online.codingblocks.com/app/player/44267/content/19258/4699?tab=submissions
This Source Code is showing error for case 3.
Not submitting the source code.
hey @ANCODE, please share the code saved in https://ide.codingblocks.com/ because text gets mismatched here.