PROGRAM interface_example ! -- declare interface block : INTERFACE SUBROUTINE expsum INTEGER, INTENT(IN) :: N REAL, INTENT(IN) :: K, X REAL, INTENT(OUT) :: sum ENDSUBROUTINE expsum ENDINTERFACE REAL :: sum ... ... ! -- call external subroutine : CALL expsum(10, 0.5, 0.1, sum) ... ... ENDPROGRAM interface_example ! -- define external subroutine : SUBROUTINE expsum INTEGER, INTENT(IN) :: n REAL, INTENT(IN) :: k, x REAL, INTENT(OUT) :: sum sum = 0.0 DO i = 1, n sum = sum + exp(-i*k*x) ENDDO ENDSUBROUTINE expsum |
...previous | up (conts) | next... |