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