1. Program to implement Bisection Method #include<conio.h> #include<stdio.h> #include<math.h> float f(float x) { //return x*x*x*x-x-10; //return x*x*x-x-1; return x - cos(x); } void main() { float x0,x1,x2; float f0,f1,f2; float e=0.001; int i=0; clrscr(); printf("Enter the values of x0 and x1 : "); scanf("%f %f",&x0,&x1); do { f0=f(x0); f1=f(x1); x2=(x0+x1)/2; f2=f(x2); if(f0*f2>0) { x0=x2; } else { x1=x2; } i++; printf("\n\nNumber of Iterations = %d",i); printf("\nRoot = %f",x2); printf("\nValue of the function = %f"
All types of program available here. Like this:- C , CPP , Data structure , Numerical method , Java programming , Java script, System Analysis and Design, PHP, Java, Computer Network