View Code of Problem 42

#include<cstdio>
#include<cmath>
using namespace std;
int main(){
	double a,b,c,x,y;
	while(scanf("%lf%lf%lf",&a,&b,&c)!=EOF){
		x=((-1)*b+sqrt(b*b-4*a*c))/(2.0*a);
		y=((-1)*b-sqrt(b*b-4*a*c))/(2.0*a);
		if(x>=y){
			printf("%.2lf %.2lf\n",x,y);
		}
		else{
			printf("%.2lf %.2lf\n",y,x);
		}
	}
	return 0;
}

Double click to view unformatted code.


Back to problem 42