Call Girls In Bangalore ☎ 7737669865 🥵 Book Your One night Stand
Roots of a quadratic equation1
1. 1: //Eqn roots.cpp
2: //Computes the roots of a quadratic equation
3: //In case of complex roots, both roots are assigned a value of 0
4: //Author: Wilson
5: //Date: 02/05/2015
6: #include "iostream"
7: #include "cmath"
8: using namespace std;
9: int main()
10: {float a(1),b(0),c(0);
11: float Rt1(0),Rt2(0);
12: float R(0);
13: cout<<"Specify the parameters of the Quadratic Equation"<<endl;
14: cout<<"enter a:";
15: cin>>a;
16: cout<<"Enter b:";
17: cin>>b;
18: cout<<"Enter c;";
19: cin>>c;
20: R=(b*b-4*a*c);
21: Rt1=((R>=0&&a!=0)?(-b+sqrt(R))/(2*a):0);
22: Rt2=((R>=0&&a!=0)?(-b-sqrt(R))/(2*a):0);
23: cout<<"nThe roots of the equation are a"<<Rt1<<" and "<<Rt2<<endl;
24: return 0;
25: }