From 01b46c5afe2435f13a0f9ba402dadb438334f753 Mon Sep 17 00:00:00 2001 From: Harshil Darji Date: Wed, 12 Oct 2016 00:03:09 +0530 Subject: [PATCH] 12 Oct --- .../Secant_method.CPP | 49 +++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 Computer Oriented Statistical Methods/Secant_method.CPP diff --git a/Computer Oriented Statistical Methods/Secant_method.CPP b/Computer Oriented Statistical Methods/Secant_method.CPP new file mode 100644 index 000000000..aedf19a02 --- /dev/null +++ b/Computer Oriented Statistical Methods/Secant_method.CPP @@ -0,0 +1,49 @@ +#include +#include +#include + +float eq(float i) +{ + return (pow(i,3)-(4*i)-9); // original 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: "<