Transposition.f90

I suggest you either typed  this as it appears into the compiler, or as an easier way, just copy and paste it!

Note: I do not claim the program will 100% work, but I give it my best. If it doesn't, try tweaking it yourself, or email me about it, and I'll modify and post the improved version later. Good luck!

 

PROGRAM transposition
IMPLICIT NONE

integer:: i

print*, "please input i:"
read*, i

call array(i)

END PROGRAM transposition

subroutine array(i1)
implicit none
integer, intent(in):: i1
integer, dimension(i1,i1):: array1
integer, dimension(i1,i1)::trans
integer::j, k, l
DO j=1,i1
array1(1:i1,j)=j
END DO
do k=1,i1
print*, array1(1:i1,k)
end do


array1=trans(i1,i1)
do k=1,i1
print*, array1(1:i1,k)
end do

return
end subroutine array
function trans(i2)
implicit none
integer, intent(in)::i2
integer, dimension(i2,i2)::array2
integer, dimension(i2,i2)::trans
integer::j, k
DO j=1,i2
array2(1:i2,j)=j
END DO
print*, array2
!trans=transpose(array2)
DO j=1,i2
array2(j,1:i2)=j
END DO
trans=array2
print*, trans
end function trans