View Code of Problem 42

#include<stdio.h>
#include<math.h>
#include<ctype.h>
#include<string.h>
#include<iostream>
using namespace std;
int main()
{
	int a,b,c;
	scanf("%d %d %d",&a,&b,&c);
	double delta=b*b-4*a*c;
	double x1=(-b+sqrt(delta*1.0))/(2*a*1.0);
	double x2=(-b-sqrt(delta*1.0))/(2*a*1.0);
	if(x1<x2)
	{
		swap(x1,x2);
	}
	printf("%.2lf %.2lf",x1,x2);
   // system("pause");

}

		

Double click to view unformatted code.


Back to problem 42