Friday, April 17, 2009

trapezoidal method //

//trapezoidal method //
#include
#include
void main()
{
int a[40],i,j,k,n;
float h,x,b=0,a1,c1;
clrscr();
printf("Enter the no of terms\n enter integral values");
scanf("%d %f %f",&n,&a1,&c1);
h=(c1-a1)/n;
printf("ENTER %d VALUES",n+1);
for(i=0;iscanf("%d",&a[i]);
for(j=0;jb+=a[j];
x=(n/2)*(a[0]+a[n])+(2*b);
printf("%f",x);
getch();
}

No comments: