Write a Numerical Program to Find the Value of Integration of a Function Using Trapezoidal Rule in Using C Language

No comments


Programs :

#include<stdio.h>
#include<conio.h>
float f(float x)
{
return(x*x*x) ;
}
void main( )
{
float x0,xn,h,sum=0.0,sum1=0.0,res;
int n,i;
clrscr( );
printf("\nEenter the lower limit and upper limit\n");
scanf("%f%f",&x0,&xn);
printf("\nEenter the no. of intervals\:n");
scanf("%d",&n);
h=(xn-x0)/n;
sum+=f(x0)+f(xn);
for(i=1;sum1+=2.0*f(x0+i*h);
res=(h/3.0)*(sum+sum1);
printf("\nThe value of the integration is =%f",res);
getch( );
}


Output :



No comments :

Post a Comment

Subscribe

Milan Panda
Admin
About Me | Contact
Copyright 2023-2024 © Programming1011 . 🎀 Developed and Design By- Milan Panda. Happy Holi All Of You 🎀