C Programming Codes To Compute Value Using Trapezoidal Rule

#include<stdio.h>
#include<conio.h>
#include<math.h>
#define F(x) exp(-(x/2))
int main()
{
int a,b,h;
float i,x,y;
printf("Enter the value for lower and upper limit\n");
scanf("%d%d",&a,&b);
h=b-a;//Calculating height
x=F(a);//Calculation Function and storing in x and y.
y=F(b);
i=h*((x+y)/2);
printf("The Intregrated Value is %.3f",i);
}

Share To:

Arogya Thapa Magar

Post A Comment:

0 comments so far,add yours