#include
#include
#include
int main()
{
clrscr();
double a,b,c,x1,x2,root;
cout<<"Enter value of a: "; cin>>a;
cout<<"Enter value of b: "; cin>>b;
cout<<"Enter value of c: "; cin>>c;
root=sqrt(b*b-4*a*c);
x1=(-b+root)/(2*a);
x2=(-b-root)/(2*a);
cout<<"Value of x1: "<
return 0;
}
Output:
Enter value of a: 2
Enter value of b: 6
Enter value of c: 1
Value of x1: -0.177124
Value of x2: -2.822876
No comments:
Post a Comment