From e016d3d4b53b55c2dd6d558fbb69aa2b07d5889a Mon Sep 17 00:00:00 2001 From: Harshil Darji Date: Sat, 15 Oct 2016 10:13:56 +0530 Subject: [PATCH] 15 Oct --- .../false-position.CPP | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Computer Oriented Statistical Methods/false-position.CPP diff --git a/Computer Oriented Statistical Methods/false-position.CPP b/Computer Oriented Statistical Methods/false-position.CPP new file mode 100644 index 000000000..6412f8458 --- /dev/null +++ b/Computer Oriented Statistical Methods/false-position.CPP @@ -0,0 +1,49 @@ +#include +#include +#include + +float eq(float i) +{ + return (pow(i,3)-(4*i)-9); // origial equation +} + +void main() +{ + float a,b,z,c,m,n; + clrscr(); + for(int i=0;i<100;i++) + { + z=eq(i); + if(z>=0) + { + b=i; + a=--i; + goto START; + } + } + + START: + + cout<<"\nFirst initial: "< 0 && z<0.09) // stoping criteria + { + goto END; + } + } + + END: + cout<<"\n\nRoot: "<