#include <stdio.h> #include <math.h> int main(){ double a,b,c; while(scanf("%lf %lf %lf",&a,&b,&c)!=EOF){ double d=b*b-4*a*c; double x1,x2; x1=(-b+sqrt(d))/(2*a); x2=(-b-sqrt(d))/(2*a); int t; if(x1<x2){ t=x1; x1=x2; x2=t; } printf("%.2lf %.2lf\n",x1,x2); } return 0; } |
Double click to view unformatted code.