You are on page 1of 1

#include<stdio.

h>
#include<math.h>
#define f(x) 1/(1+pow(x,2))/[tan-1x] limit 0 to 6=
void main()
{
float h,x0,xn,y0,yn,term,val,np;
int i,n;
printf("\n enter the lower and upper limit \n");
scanf("%f %f",&x0,&xn);
printf("\n enter the no of segments=");
scanf("%d",&n);
h=(xn-x0)/n;
y0=f(x0);
yn=f(xn);
term=f(x0)+f(xn);

for(i=1;i<=n-1;i++)
{
np=x0+i*h;
term=term+2*(f(np));
}

val=h/2*term;
printf("\n Value of the integration=%f",val);
}

You might also like