I used the registered version of the Simply Fortran compiler, here: simplyfortran-3.0.msi, simplyfortran-2.35.msi; also, try the online Fortran compiler.
PROGRAM MAIN
! inhibit older feature
IMPLICIT NONE
! declare numbers
INTEGER N, X
! declare sub
EXTERNAL SUB1
! declare global variable
COMMON /GLOBALS/ N
! set initial value
X = 0
! input how many interations
PRINT *, 'Enter number of interations: '
READ (*,*) N
! goto sub1
CALL SUB1(X,SUB1)
! end program
END
! our sub
SUBROUTINE SUB1(X,LOOP)
INTEGER N, X
EXTERNAL LOOP
COMMON /GLOBALS/ N
IF(X .LT. N)THEN
X = X + 1
PRINT *, 'x = ', X
CALL LOOP(X,LOOP)
END IF
! end if
! end sub
END
Output
Notes
Learn more, Fortran language
https://pinetools.com/syntax-highlighter
Types of Variables
Integer: It can hold only integer values.
Real: It stores the floating point numbers.
Complex: It is used for storing complex numbers.
Logical: It stores logical Boolean values.
Character: It stores characters or strings.