From 40d6a64856fd4d4b722da188364c974552234758 Mon Sep 17 00:00:00 2001 From: Harshil Darji Date: Fri, 14 Oct 2016 09:24:46 +0530 Subject: [PATCH] 14 Oct --- .../simpson's 1-3rd rule.c | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 Computer Oriented Statistical Methods/simpson's 1-3rd rule.c diff --git a/Computer Oriented Statistical Methods/simpson's 1-3rd rule.c b/Computer Oriented Statistical Methods/simpson's 1-3rd rule.c new file mode 100644 index 00000000..7c04b89c --- /dev/null +++ b/Computer Oriented Statistical Methods/simpson's 1-3rd rule.c @@ -0,0 +1,34 @@ +#include +#include +#include +float f(float x) +{ + return 1.0+x*x*x; +} +void main() +{ + int i,n; + float a,b,h,x,s2,s3,sum,integral; + printf("enter the lower limit of the integration"); + sacnf("%f",&a); + printf("enter the upper limit of the integration"); + sacnf("%f",&b); + printf("enter the number of intervals"); + sacnf("%d",&n); + h=(b-a)/n; + sum=f(a)+f(b); + s2=s3=0.0; + for(i=1;i