Program for Bisection Method in C++


Program for Bisection Method in C++

#include<iostream>// include header file
using namespace std;
double f(double x)
{
return(x*x*x-2*x-5); //return given function
}
int main()
{
double a,b,c;
int i;
cout<<"enter the range in which root lies"<<endl;
cin>>a>>b;
while((b-a)>=0.0001)
{
c=(a+b)/2;  //to find middle range
if(f(a)*f(c)<0)
{
b=c;
}
else
{
a=c;
}
cout<<"root ="<<c<<endl;
}
cout<<"final currect root ="<<c;
return(0);
}

1 comment:

  1. Program For Bisection Method In C++ - Codeshield >>>>> Download Now

    >>>>> Download Full

    Program For Bisection Method In C++ - Codeshield >>>>> Download LINK

    >>>>> Download Now

    Program For Bisection Method In C++ - Codeshield >>>>> Download Full

    >>>>> Download LINK XM

    ReplyDelete

INSTAGRAM FEED

@maurya_m_j