srdjan@Zverko ~/Documents $ ls
Primer.f90
srdjan@Zverko ~/Documents $ cat Primer.f90
PROGRAM MAIN
INTEGER N, X
EXTERNAL SUB1
COMMON /GLOBALS/ N
X = 0
PRINT *, 'Enter number of repeats'
READ (*,*) N
CALL SUB1(X,SUB1)
END
SUBROUTINE SUB1(X,DUMSUB)
INTEGER N, X
EXTERNAL DUMSUB
COMMON /GLOBALS/ N
IF(X .LT. N)THEN
X = X + 1
PRINT *, 'x = ', X
CALL DUMSUB(X,DUMSUB)
END IF
END
srdjan@Zverko ~/Documents $ gfortran Primer.f90 -o Primer
srdjan@Zverko ~/Documents $ ./Primer
Enter number of repeats
5
x = 1
x = 2
x = 3
x = 4
x = 5
srdjan@Zverko ~/Documents $