You are on page 1of 1

c simpson 1/3 rule

write(*,*)'lower limit,upper limit'


read(*,*)a,b
h=(b-a)*0.5
x=(a+b)*0.5
sum=f(a)+4*f(x)+f(b)
s=h/3*sum
write(*,*)'value of integral=',s
stop
end
c subroutine for function
function f(x)
f=exp(-x**2)*sin(x)
return
end
..............output....................
lower limit,upper limit
0
3.14
value of integral= 0.177970

Press RETURN to close window...

You might also like