Header Ads

Header ADS

URI 1036 Bhaskara's Formula Solution in C++

URI 1036 👀 Bhaskara's Formula 👀Solution in C++

Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just find out the logic. If you stuck in trouble, just inform me on comment.
https://programminglife77.blogspot.com/2018/10/uri-1036-bhaskaras-formula-solution-in-c.html

URI 1035 Solution Bhaskara's Formula in C++


#include<bits/stdc++.h>
#include<math.h>
using namespace std;

int main(){
    double a,b,c,t,R1,R2;
    cin>>a>>b>>c;

    if(((b*b)-4*a*c)<0 ||a==0){
        cout<<"Impossivel calcular"<<endl;
    }else{
         t=sqrt((b*b)-4*a*c);
         R1=((-b + t) / (2 * a));
         R2=((-b - t) / (2 * a));
         cout<<fixed;
         cout<<setprecision(5)<<"R1 = "<<R1<<endl;
         cout<<setprecision(5)<<"R2 = "<<R2<<endl;

    }

return 0;}


No comments

URI 1070 Six Odd Numbers Solution in C++

URI 1070 Six Odd Numbers Solution in C++ Before seeing the solution make sure that you tried enough. Don’t paste the whole code, just fin...

Powered by Blogger.