Implement a function double rootdoublea double b double c wh

Implement a function double root(doublea, double b, double c) which returns

Implement a function double root(doublea, double b, double c) which returns -B + Squareroot b^2 - 4ac/2a

Solution

Solution.cpp


#include <iostream>//header file for input output function
#include<cmath>//header filr for math functions
using namespace std;//it tells the compiler to link std namespace
double root(double,double,double);//function declaration
int main()
{//main function
    double a,b,c;
    cout<<\"enter a value=\";
    cin>>a;//key board inputting
    cout<<\"enter b value=\";
    cin>>b;//key board inputting
  
    cout<<\"enter c value=\";
    cin>>c;//key bard inputting
    root(a,b,c);//function calling
  
return 0;
}
double root(double a,double b,double c)
{//function definition
double value=-b+sqrt(b*b)-(4*a*c)/(2*a);
cout<<\"value=\"<<value;
return value;
}


output

enter a value=3

enter b value=3

enter c value=3

value=-6

Implement a function double root(doublea, double b, double c) which returns Implement a function double root(doublea, double b, double c) which returns -B + Squ

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site