SUBROUTINE3
!Program name: SUBROUTINE3
integer
:: V(6), U(6), M(2,3), N(2,3), R(2,3)
logical :: T(6), L(2,3)
interface
subroutine write_array(A)
integer :: A(:,:)
end subroutine write_array
subroutine write_logical_array(A)
logical :: A(:,:)
end
subroutine write_logical_array
end interface
V=[11,12,13,14,15,16]
U=[1,2,3,4,5,6]
T=[.true., .false., .true.,
.true., .false., .false.]
M=reshape(V,(/2,3/))
N=reshape(U,(/2,3/))
L=reshape(T,(/2,3/))
R=merge(M,N,L)
call write_array(M)
call write_array(N)
call write_logical_array(L)
call write_array(R)
end
subroutine write_array(A)
integer :: A(:,:)
do i=lbound(A,1), ubound(A,1)
write (*,*) (A(i,j),
j=lbound(A,2),ubound(A,2))
end do
return
end subroutine write_array
subroutine
write_logical_array(A)
logical :: A(:,:)
do i=lbound(A,1), ubound(A,1)
write (*,*) (A(i,j),
j=lbound(A,2),ubound(A,2))
end do
return
Comentários
Postar um comentário