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: "<