View Code of Problem 42

#include <stdio.h>
#include <math.h>
int main()
{
	double a, b, c;
	double e, f, g;
	printf("");
	scanf("%lf%lf%lf", &a, &b, &c);
                              
	e = b * b - 4 * a * c; 
	f = - b + sqrt(e);
	g = - b - sqrt(e);
	f = f * 0.5 / a;
	g = g * 0.5 / a;
	 if(f>g)
	 {
	 	printf("%.2f %.2f\n", f, g);
	 }
	else{
		printf("%.2f %.2f\n", g, f);
	}
	
	
	
	return 0;
	
 } 

Double click to view unformatted code.


Back to problem 42