View Code of Problem 42

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>

int main() {
	double a,b,c;
	scanf("%lf %lf %lf",&a,&b,&c);
	double t,r1,r2,x1,x2,temp;
	t=sqrt(b*b-4*a*c);
	r1=-b+t;
	r2=-b-t;
	x1=r1/(2*a);
	x2=r2/(2*a);
	if(x1<x2){
		temp=x1;
		x1=x2;
		x2=temp;
	}
	printf("%.2lf %.2lf",x1,x2);
}

Double click to view unformatted code.


Back to problem 42