C code using Weddle’s rule

Problem: Here we have to find integration for the (1/1+x*x)dx with lower limit =0 to upper limit = 6

Algorithm:

Step 1: input a,b,number of interval n

Step 2:h=(b-a)/n

Step 3:If(n%6==0)

Then , sum=sum+((3*h/10)*(y(a)+y(a+2*h)+5*y(a+h)+6*y(a+3*h)+y(a+4*h)+5*y(a+5*h)+y(a+6*h)));
a=a+6*h
and Weddle’s rule is applicable then go to step 6

Step 4: else, Weddle’s rule is not applicable

Step 5:Display output

Code:

Output:

2014-11-27 02_44_27-