# Solve Simpsons Rule C Program

## C Program To Solve Simpsons Rule

Learn How To Implement Simpsons Rule in C Programming Language. Find out the easiest way to write a C Program for Simpsons 1/3rd Method Implementation. Simpson’s method corresponds to the **3-point Newton-Cotes quadrature** rule as well.

#### What is Simpson’s Rule

Simpson’s rule is a method for Numerical Integration. It is primarily used for Numerical approximation of definite integrals. It is a method to approximately calculate the definite integral. Simpson’s Theorem is used to find the area under a given curve. There are primarily two methods in Simpsons Rule. The fist one is Simpson’s 1/3 rule and the other one is Simpson’s 3/8 rule.

#### Simpson’s Rule Formula

**Must Read: C Program For Trapezoidal Rule**

#### C Program To Solve Simpsons Rule without using Function

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | #include<stdio.h> #include<math.h> int main() { int interval, count; float m = 0, n = 0, sum, lower_limit, upper_limit, length; printf("\nEnter the Intervals:\t"); scanf("%d", &interval); printf("\nEnter Lower Limit:\t"); scanf("%f", &lower_limit); printf("\nEnter Upper Limit:\t"); scanf("%f", &upper_limit); length = (upper_limit - lower_limit) / interval; if(interval%2 == 0) { for(count = 1; count <= interval - 1; count++) { if(count%2 == 0) { m = m + (lower_limit + count * length); } else { n = n + (lower_limit + count * length); } } sum = length / 3 * (lower_limit + upper_limit + 4 * n + 2 * m); printf("\nSimpson's Rule Value:\t%f\n", sum); } else { printf("\nThe values are Invalid\n"); } return 0; } |

**Must Read: Find Sum of Two Complex Numbers in C Programming**

#### Output

If you have any compilation errors or doubts in this C Program To Implement Simpson’s 1/3rd Rule, let us know about in the Comment Section below. To know more about Simpson’s Method and its implementation, check this article on **Wikipedia**.

Why to waste time by writing a C Program for Simpson’s Rule? Who sees such kinds of C Programs these days?

You may be thinking right. But, once in a bluemoon, someone may search for these kind of C programs. My main motive is to make Internet a resourceful place. I believe if any article is correct and holds some value, it should be there on the internet.

This code is too good. Thanks for such an easy program for Simpson’s Formula in C Programming

Thanks for the integration by simpson 1/3 and 3/8 rule in c programming. This has made my day. 🙂

Why waste time? He’s not. For one thing, if you bothered to THINK, you’d have realized that by just reading the C code, you get the ALGORITHM that you can render in any language you choose. And it also happens that Pascal and C are the basis for a great many modern languages today. Not to mention C is still in use in embedded systems because of its speed and it’s ability in IO and operating system interfacing. A lot of drivers are written in C START THINKING!

How can I solve Simpsons Rule in C Programming For 3/8th Rule? Can I modify this program?

Amazing code. Thanks