Professional Documents
Culture Documents
THEORY:
SOURCE CODE:
#include <stdio.h>
#include <math.h>
double func(double x)
{
return 1 / (1 + x * x);
}
int main()
{
int i, n;
double a, b, h, sum = 0, x, y;
h = (b - a) / n;
x = b;
y = func(b);
printf("x%d = %lf\t", n, x);
printf("y%d = %lf\n", n, y);
sum = (sum + y) * h / 3;
sum += func(a) + func(b);
return 0;
}
OUTPUT:
Here, we discussed about the algorithm and source code of Simpson 1/3 Rule and we
practically coded the source code of the of Simpson 1/3 Rule using C programming
language to test the example of solution of a problem relating to of Simpson 1/3 Rule.