program main        ! make up your own name
    implicit none   ! no implicit declarations - safer
    integer             :: i
    integer, parameter  :: count = 10

    do i = 1, count
        call doit ( i )
    end do

contains

    subroutine doit ( i )
        implicit none            ! no implicit declarations
        integer, intent(in) :: n ! declare n as an input parameter
        write(*,*) i, square(i)
    end subroutine doit

    integer function square ( n )
        implicit none            ! no implicit declarations
        integer, intent(in) :: n ! declare n as an input parameter
        doit = n * n             ! assign to a variable with the function name
    end function square

end program main
