Advertisement
Guest User

recursive-example

a guest
May 27th, 2019
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. PROGRAM MAIN
  2.       INTEGER N, X
  3.       EXTERNAL SUB1
  4.       COMMON /GLOBALS/ N
  5.       X = 0
  6.       PRINT *, 'Enter number of repeats'
  7.       READ (*,*) N
  8.       CALL SUB1(X,SUB1)
  9.       END
  10.  
  11.       SUBROUTINE SUB1(X,DUMSUB)
  12.       INTEGER N, X
  13.       EXTERNAL DUMSUB
  14.       COMMON /GLOBALS/ N
  15.       IF(X .LT. N)THEN
  16.         X = X + 1
  17.         PRINT *, 'x = ', X
  18.         CALL DUMSUB(X,DUMSUB)
  19.       END IF
  20.       END
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement