View Code of Problem 42

#include<bits/stdc++.h>
using namespace std;
int main(){
	float x,y,z;
	cin>>x>>y>>z;
	float ans1,ans2;
	ans1=((-y+sqrt(y*y-4*x*z))/2*x);
	ans2=((-y-sqrt(y*y-4*x*z))/2*x);
	if(ans1<ans2)
	printf("%.2f %.2f",ans2,ans1);
	else
	printf("%.2f %.2f",ans1,ans2);
	return 0;
}

Double click to view unformatted code.


Back to problem 42