View Code of Problem 42

#include<iostream>
#include<cmath>
#include<iomanip>
using namespace std;
int main()
{   double a,b,c,p,x1,x2;
    cin>>a>>b>>c;
    p=b*b-(4*a*c);
    x1=(-b+sqrt(p))/2*a;
    x2=(-b-sqrt(p))/2*a;    
	cout<<fixed<<setprecision(2)<<x1<<" "<<x2<<endl;
}

Double click to view unformatted code.


Back to problem 42