View Code of Problem 42

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

int main(int argc, char** argv) {
	double a , b , c;
 	double desc;
 	scanf("%lf %lf %lf" , &a , &b , &c);
	desc = b * b - 4 * a *c;
	double x1 =   ( -b + sqrt( desc ) ) /(2 * a);
	double x2 =   ( -b - sqrt( desc ) ) /(2 * a);
	if( x1 < x2){
		double t = x1;
		x1 = x2 ;
		x2 = t;
	}
	printf("%.2lf %.2lf" , x1 , x2);
	return 0 ;
}












Double click to view unformatted code.


Back to problem 42