程序单元里不能直接放入另一个程序单元,需要符合一定的规则。
[Fortran] 纯文本查看 复制代码 program hello
implicit none
real :: ss,s(4)
call fcount(50,s(1))
call fcount(100,s(2))
call fcount(150,s(3))
call fcount(200,s(4))
ss=sum(s)
print *, "s=", ss
contains
subroutine fcount(n,s)
integer :: n , i
real :: s
s=0
do i=1,n
s=s+1./i
end do
end subroutine fcount
end program hello |