/********* TRY YOURSELF FIRST **********/
|
URI - Solve - 1036 |
Problem Details:Click to see full proble...
Solution i C++:
#include <iostream>
#include <math.h>
#include<iomanip>
using namespace std;
int main()
{
float a , b , c , r1 , r2,num;
cin >> a >> b >> c;
num = (b*b)-(4*a*c);
if(num > 0 && a!=0){
r1= (-b+ sqrt(num))/(2*a);
r2= (-b-sqrt(num))/(2*a);
cout << "R1 = "<<fixed<<setprecision(5)<<r1 << endl;
cout << "R2 = "<<fixed<<setprecision(5)<<r2 << endl;
}
else
cout<<"Impossivel calcular"<<endl;
return 0;
}
Comments
Post a Comment
Thanks for your message