Hi! Im using fortran and am trying to create a integrating program that is able to use different functions. I have written the subroutine that will integrate but would also like it to be able to use different functions determine by user selection. Here is my subroutine: subroutine comptrap implicit none double precision h,f,f1,f2,x,x1,x2,int double precision func1 integer n,i print*, 'Enter x1, the lower boundary.' read*, x1 print*, 'Enter x2, the upper boundary.' read*,x2 print*, 'Enter the number of intervals, n.' read*, n h=(x2-x1)/n int=0 do i=1,(n-1) x=x1+(h*i) f=func1(x) print*, f int=int+f end do f1=func1(x1) f2=func1(x2) int=h*(int+(f1+f2)/2) print*, f1,f2,'Integral=',int,h end subroutine And an example of a function: double precision function func1(x) implicit none double precision x func1=x**2 end If anyone could advise me on how to program it to allow a function to be picked for integration that that would be great. Thanks in advance.