#include using namespace std; double f(double x) { return (double) (x*x*x) + (x*x) - 1; } double g(double x) //equation of x { return (double) sqrt(1/(1+x)); } int main() { double x0, a, b, xn=1; int iter = 0; x0 = 0; a = f(x0); // finding interval while(1) { x0++; b = f(x0); if(a*b < 0) { a = x0 - 1; b = x0; break; } a = b; } cout<<"the interval i = ["< 0.0001) { x0 = xn; xn = g(x0); iter++; cout<<" "< } cout<<"\n\nthe root of the equation x^3 + x^2 - 1 = 0 is "< return 0; } convert this code to c language
Get the answer
Category: geography |
Author: Giiwedin Frigyes
Related Questions
#include #include #include using namespace std; int main() { // fil

#include using namespace std; const int size 4; void printarray(int

#include using namespace std; int main() { int x, y=0; x=1123; while

Category
science
#include #include #include using namespace std; class song { public: void setnameandduration(string songname, int songduration) { name = songname; dur
ecology
#include ad libs are activities that have a person provide various words, which are then used to complete a short story in unexpected (and hopefully f
art
#include using namespace std; class inventorytag { public: inventorytag(); int getquantityremaining() const; void addinventory(int numitems); private: