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